Except in the case where you are running the replace or match function on an input string variable.
function StrRep(inStr, repStr){
var re = new ReExp(inStr);
...
}
> -------Original Message-------
> You don't *have* to create a regexp object in order to use regular
> expressions:
>
> Var s = "pooString"
>
> S.replace( /poo/, "pee" )
>
> I find this more legible than all the crap wraparound stuff in the MS docs.
>
> You can also say:
>
> Re = /poo/g;
>
> And in your example:
>
> Re = /\\/;
>
> Will work.
>
> > -----Original Message-----
> > From: owner-xsi(at)Softimage.COM
> > [mailto:owner-xsi(at)Softimage.COM] On Behalf Of brad
> > Sent: 25-October-2005 18:08
> > To: xsi(at)Softimage.COM
> > Subject: Slashing back at RegExp
> >
> > In jscript, the following raises an error:
> >
> > re = new RegExp("\\");
> >
> > And so does this:
> >
> > var str = "C:\\";
> > re = new RegExp(str);
> >
> >
> > I have a workaround that gets the job done, but I was
> > wondering if anyone has figured out a way to instantiate the
> > RegExp object for backslashes.
> >
> >
> > Cheers!
> > -Brad
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
> > text in body:
> > unsubscribe xsi
> >
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi