Click to See Complete Forum and Search --> : Regular Expressions


IceMetalPunk
04-17-2004, 07:43 PM
Hi-
How do you check to see if a string has any letters in it? I tried this:

stringtocheck.match("[a-z][A-Z]");

I tried it with and without the quotes around [a-z][A-Z], but it still doesn't work. Can anyone help me? I'm using Netscape 7.1 if that makes a difference...

:( IceMetalPunk :(:confused: :confused:

fredmv
04-17-2004, 07:56 PM
/\w/g.test('abc'); // true

IceMetalPunk
04-17-2004, 08:00 PM
Um, I'm not really familiar w/ regular expressions. Where would I put that code if the string to check was a variable called stringtocheck?

-IceMetalPunk

fredmv
04-17-2004, 08:35 PM
Where I placed "abc" — check out the Netscape DevEdge Regular Expressions guide (http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/regexp.html).