Skip to main content

verdy_p

Member since Dec 28, 2009

Recent Blog Comments By verdy_p

  • Javascript Exec() Method For Regular Expression Matching

    Posted on Dec 28, 2009 at 2:22 AM

    Sorry, replace: for var re = /\t/g, match = re.exec(string); match != null; match = re.exec(match.source)) { ...// use the match[0] substring which maps to match.source at position match.index } by: for (var re = /\t/g, match = re.exec(string); match != null; match = re.exec(match.input)) { ...//... read more »

  • Javascript Exec() Method For Regular Expression Matching

    Posted on Dec 28, 2009 at 1:59 AM

    Note also: if the "g" flag is specified, this is the only case where at most one match will be returned in the non-null array (the loop is then needed) and the regexp object will be modified to hold the lastIndex. In that case also, the returned non-null array (match above) will not just be an array... read more »

  • Javascript Exec() Method For Regular Expression Matching

    Posted on Dec 28, 2009 at 12:59 AM

    NEVER use the code: while (match = /\t/g.exec(string)) { ...// use match[] array... } which effectively can recompile the regexp at each iteration (the /\t/g syntax is considered in IE as the equivalent of instanciating a new Regexp with the string "\\t" and the flag "g", as if you had effectively... read more »

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel