[thelist] regex problem

Chris at globet.com Chris at globet.com
Mon Oct 10 08:14:42 CDT 2005


Tom

[..]

> var strippedNameValue = nameValue.replace(/^[\*]$/g, "");

This only matches the string "*", as you are specifying [start of
string][one instance of char *][end of string]. Try:

var strippedNameValue = nameValue.replace(/[\*]/g, "");

[..]

Chris Marsh
Web Developer
http://www.globet.com/
Tel: +44 20 8246 4804 Ext 828
Fax: +44 20 8246 4808

Any opinions expressed in this email are those of the individual and not
necessarily the Company. This message is intended for the use of the
individual or entity to which it is addressed and may contain
information that is confidential and privileged and exempt from
disclosure under applicable law. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please contact the
sender immediately and delete it from your system.  

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org 
> [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tom Dell'Aringa
> Sent: 10 October 2005 13:47
> To: thelist
> Subject: [thelist] regex problem
> 
> Hi there, 
> 
> My weekly regex conundrum! I have a string where I want to 
> strip out any occurance of a wildcard '*'. I am attempting this:
> 
> 
> 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?
> 
> TIA
> 
> Tom
> 
> 
> http://www.pixelmech.com/
> 
> A man spoke frantically into the phone: "My wife is pregnant 
> and her contractions are only two minutes apart"! "Is this 
> her first child?" the doctor asked. "No, you idiot!" the man 
> shouted. "This is her husband!"
> 
> Q: What do you call a muddy chicken who crossed the road two times?
> A: A dirty double crosser...
> 
> -- 
> 
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip 
> Harvester and archives of thelist go to: 
> http://lists.evolt.org Workers of the Web, evolt ! 
> 
> 


More information about the thelist mailing list