RE: Slashing back at RegExp

Date : Tue, 25 Oct 2005 18:25:30 +0100
To : <XSI(at)Softimage.COM>
From : "kim aldis" <kim(at)cg-soup.com>
Subject : RE: Slashing back at RegExp
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


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.