[thelist] regex problem
Frank
lists at frankmarion.com
Mon Oct 10 08:34:01 CDT 2005
At 08:47 AM 2005-10-10, you wrote:
>My weekly regex conundrum! I have a string where I want to strip out any
>occurance of a wildcard
>'*'. I am attempting this:
>
>var strippedNameValue = nameValue.replace(/^[\*]$/g, "");
>
>with the test string "t**"
>
>This does not work, I always end up with the same string, it is not
>replacing the *. I have
>escaped the * but it does not seem to match it - what am I doing wrong?
The answer to todays RegEx puzzle, brought to you by Tom Dell'Aringa, maker
of fine websites worldwide is
s= "* this *one was ******* easy*";
s = s.replace(/\**/g, "");
alert(s);
Frank Marion lists at frankmarion.com Keep the signal high.
More information about the thelist
mailing list