Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: javascript - wildcards
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: javascript - wildcards



Thanks Jens,

I found that the "return" statement was hiding the result.

I looked up "regular expressions" in my three books and found nothing. A few days ago I didn't know that "replace" and "regular expressions" had anything to do with each other.

I found the "https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp" very helpful.



On Jul 6, 2009, at 10:33 PM, Jens Alfke wrote:


On Jul 6, 2009, at 1:50 PM, Robert Poland wrote:

What I'm after is for this line to remove all letters;
elementValue = elementValue.replace(/a-z/ig, '')
I have tried [a-z], {a-z}, "a-z".

You want:
elementValue = elementValue.replace(/[a-z]/ig, '')

Can't find any mention of this in my books or on the web.

There are entire books written about regular expressions :) I have one, although it's just the little "pocket guide" from O'Reilly.
And any _javascript_ book worth its salt should have at least a chapter on RE's.
Here's some documentation from mozilla's _javascript_ reference:

—Jens


Bob Poland - Fort Collins, CO



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >javascript - wildcards (From: Robert Poland <email@hidden>)
 >Re: javascript - wildcards (From: Jens Alfke <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.