Page 1 of 1

javascript ereg?

Posted: Thu Aug 08, 2002 9:57 pm
by wickedbob
is there a javascript equivalent for php's ereg_replace?

BoB.

Yes, there is.

Posted: Fri Aug 09, 2002 6:02 am
by Geschi
If you're using Javascript 1.2 the syntax is as follows:

Code: Select all

YourString.replace(regularExpression, newSubString)
However with Javascript 1.3 there's also:

Code: Select all

Your.String.replace(regularExpression, newFunction(Arg1,Arg2...){"code"})

Posted: Mon Aug 26, 2002 1:17 am
by Takuma
I use Javascript 1.3, what do I use?