...

View Full Version : Easy Regular Expression?



TNO
09-18-2005, 08:20 AM
Greetings,

I'm evaluating the following function:


if(Left(delines.item(),18)=="\n ")

This works properly when I need it to, but the following will not:


if(Left(delines.item(),19)=="\n \w")

I'm trying to match a single instance of a nonwhitespace character but am not getting the desired results.

And please don't tell me to create a regular expression pattern then use the exec method.......

Philip M
09-18-2005, 09:56 AM
// if (/\s+/.test(theVariable.value)) { // match one or more whitespace characters
alert ("Whitespace present!");
}

or

// if (/\s/.test(theVariable.value)) { // match just one whitespace character

TNO
09-18-2005, 10:27 AM
Thanks, I got it,


if((Left(delines.item(),18)=="\n ")&&(Left(delines.item(),19)!="\n "))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum