replace « regex « jQuery Q&A

Home
jQuery Q&A
1.addClass
2.alert
3.array
4.attribute
5.browser
6.callback
7.clone
8.Cookie
9.Date
10.Development
11.document
12.dom
13.element
14.filter
15.Firefox
16.flash
17.format
18.html
19.input
20.internet explorer
21.json
22.mootools
23.page
24.performance
25.regex
26.safari
27.selector
28.setTimeout
29.String
30.table
31.Text
32.trigger
33.URL
34.video
35.xml
jQuery Q&A » regex » replace 

1. Is there a better way to write this javascript regex/replace?    stackoverflow.com

The following code works, but I'm sure there is a more compact way to achieve the same result, particularly the string replacement:

$('#nav-main .nav-sub').each(function() {

 var name = $(this).attr('id');

 $(this).children('li').children('a').each(function() {

  ...

2. Opera 10, jquery with regex replace    stackoverflow.com

I have a jquery plugin that is working on all browsers, except opera. The removeHighlight function gets triggered, but the html is not changed. As far as I can see IE, ...

3. Javascript replace problems (with alt and title atribbutes )    stackoverflow.com

i have the following code:

function getArticleContent() {

    var toPromote = 'example';

    var toReplace = '<a href="/tags/'+toPromote+'">'+toPromote+'</a>';

    var content = $(".a-entry").text();

   ...

4. Javascript or regex solution to make markup XHTML compliant    stackoverflow.com

I have an inline markup editor built into my website, which should produce XHTML compliant markup. But as you can see, it uses the deprecated font tag and size attribute. ...

5. Javascript Regex - Replace { with nothing    stackoverflow.com


i have a little problem and i have no idea what is wrong

    var selector_css;
    var sheet= document.styleSheets[0];
    var rules= 'cssRules' ...

6. jQuery + regular expression how to replace this URI    stackoverflow.com

I have a simple URI that looks like the following:

/stuff/assets/1234/asset/foobar
What's the proper way with jQuery to replace the assets with another word? if I do a simple .replace('asset', 'something') it changes ...

7. Replace two double quotes with single one using jquery    stackoverflow.com

How do I replace two double quotes into single one using jQuery? For example: I need to replace

Sam is at his ""Home""
to
Sam is at his "Home"
Looking for something ...

8. Combining regex in jQuery    stackoverflow.com

I have this jQuery code which replaces some HTML character codes with their equivalent:

$('.someText').html()
              .replace(/&amp;/g, '&')
   ...

9. javascript jquery regexp replace    stackoverflow.com

I'm trying to create a dynamic searchbar and i need help. Right now im trying to replace a string with another string but i cant seem to succeed. Im getting input from the ...

10. RegEx Replace with Javascript    stackoverflow.com

I'm struggling with an issue of Javascript RegEx replacement. What I need to do is run a replacement over a paragraph of text looking for "[card]lorem ipsum[/card]" I found jQuery plugins which ...

11. How to replace src with regular expression and jquery    stackoverflow.com

I have the following output.

<img width='70' height='70' class='centreimg' src="http://localhost/aktivfitness_new/assets/images/centre/centre1.jpg" />
There are same outputs with centre2.jpg etc. Now I want to replace this centre1.jpg to hover.jpg when I hover. But when I use ...

12. javascript replace issue    stackoverflow.com

i have buildt a small highlight script, this script has a results tags, which means that you can enter words in a input field and it will be displayed as clickable ...

13. Replace multiple \n with 1 in JavaScript    stackoverflow.com

How do I replace multiple \n's with just one? So if a user enters

blah 

blahdy blah



blah blah
I want it to end up looking like.
blah
blahdy blah
blah blah
I know I could loop through ...

14. RegEx Replacement in JavaScript    stackoverflow.com

I have a piece of code which replaces tokens in a string. I have the replacement values stored in an array. Essentially, I would like to analyse the string and replace it ...

15. replace all but - ,+, and .     stackoverflow.com

I'm working on a donation webapp, and I need to format a string the will leave minuses (-), pluses (+), and decimals (.). I want people to be able to ...

16. jQuery dynamic replacement with RegEx    stackoverflow.com

If i have {code}{type="hey"} and I want to replace it with <code><pre class="hey"> how can I do it binding some method to this function:

$('.wysiwyg textarea').live('keyup',function(){

    wysiwyg_val = $(this).val();

 ...

17. Javascript regexp replace, multiline    stackoverflow.com

I have some text content (read in from the HTML using jQuery) that looks like either of these examples:

<span>39.98</span><br />USD
or across multiple lines with an additional price, like:
<del>47.14</del>

    ...

18. jquery regex replace() only runs twice... then doesn't    stackoverflow.com

I ashamed and frustrated by this question. I'm writing what should be a pretty simple script that removes "y"s and replaces them with "i"s. When this happens, I add a ...

19. Replace sentences with Regex in JS    stackoverflow.com

I've got the following 'dictionary':

var dictionary = {
    "Log in again": "Just do it again",
    "Test phrase": "Lorem ipsum",
    "word": "other word"
}
Once ...

20. JavaScript/Jquery Regexp Replace    stackoverflow.com

I'm doing a hovercard plugin for my site but have a problem with getting user id. profile urls can be;

hxxp://mysite.com/?p=profile&id=1
hxxp://mysite.com/?p=profile&id=1&page=2
hxxp://mysite.com/?p=profile&id=1&v=wall
etc.. How can I get profiles' id by javascript Regexp Replace?
    ...

21. Javascript replace isn't working?    stackoverflow.com

I'm working on a greasemonkey script, but the str.replace function isn't working. I'm trying to disable the onmousedown functions for Google searches, my thought was that by replacing that with nothing, it ...

22. How can I replace this in jQuery?    stackoverflow.com

I have the following element:

<span data-valmsg-for="Company.People[0].Name" />
What I would like to do, is take the 'data-valmsg-for' attribute and format it to look like this:
var idToLocate = "Company.People_0__Name";
How can I accomplish this ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.