Thanks, it's weird though, I copied a regex from the _javascript_ reference
and just replaced it with what came out of the vis regex editor. The
reference had the quotes!
Thanks again
Steve
-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 3:38 AM
To: CF-Talk
Subject: RE: _javascript_ regex problem.
<script language="_javascript_">
<!--
function dispTest(){
var UpdprojStart = " "; //five spaces.
UpdprojStart = UpdprojStart.replace(/\s+/ig, "-");
alert("|" + UpdprojStart + "|");
UpdprojStart = " 1 2 3 4 5"; //a space before each number.
UpdprojStart = UpdprojStart.replace(/\s+/ig, "-");
alert("|" + UpdprojStart + "|");
}
dispTest();
//-->
</script>
regexs are not defined between quotes but between slashes in js. Also
need g (global, same as "ALL" in regex functions from CF). You can also
use i (case insensitive). You also need the + instead of *, because you
only want to replace if there is a space. Otherwise you will add a
hyphen before each character.
Pascal
-----Original Message-----
From: DURETTE, STEVEN J (AIT) [mailto:[EMAIL PROTECTED]
Sent: maandag 6 oktober 2003 21:57
To: CF-Talk
Subject: OT:_javascript_ regex problem.
Hi all,
I have a little problem with some _javascript_ and a regex that I can't
seem
to figure out.
I have the following code:
<script language="_javascript_">
<!--
function dispTest(){
var UpdprojStart = " "; //five spaces.
UpdprojStart = UpdprojStart.replace("[\s]*", "-");
alert("|" + UpdprojStart + "|");
UpdprojStart = " 1 2 3 4 5"; //a space before each number.
UpdprojStart = UpdprojStart.replace("[\s]*", "-");
alert("|" + UpdprojStart + "|");
}
//-->
</script>
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

