View Full Version : Easy Regular Expression?

09-18-2005, 07:20 AM

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, 08:56 AM
// if (/\s+/.test(theVariable.value)) { // match one or more whitespace characters
alert ("Whitespace present!");


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

09-18-2005, 09: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