RE: Slashing back at RegExp

Date : Tue, 25 Oct 2005 19:35:02 +0000
To : XSI(at)Softimage.COM
From : "brad" <brad(at)cg-soup.com>
Subject : RE: Slashing back at RegExp
In essence, this is the workaround I've been using. Preswapping backslashes, running the replace, replaces the backslashes. I was hoping there might be a more optimal way, akin to string literals from Python, for example.

-Brad

>  -------Original Message-------
>  If you know what you're looking for, you can still process the incoming
>  string with literals.  For example, it's unknown what the incoming variable
>  'str' contains, but I know I want to convert backslashes to forward slashes.
>    So, dump 'str' into a replace while searching for a literal backslash.  
>  Avoids the double escape issue.
>  
>  --------------------------------------------------
>  var str = "C:\\tmp\\backup\\whatever";
>  
>  main( str );
>  
>  
>  function main( str )
>  {
>  LogMessage( str.replace( /\\/g, "/" ) );
>  return(0);
>  }
>  -----------------------------------------------------------
>  
>  
>  Matt
>  
>  ------------------------------
>  Matt Lind
>  Animator / Technical Director
>  SOFTIMAGE certified instructor:
>     SOFTIMAGE|3D
>     SOFTIMAGE|XSI
>  Mantom, Chicago
>  Matt(at)Mantom.net
>  
>  
>  RE: Slashing back at RegExp
>  Date : Tue, 25 Oct 2005 17:50:24 +0000
>  To : XSI(at)Softimage.COM
>  From : "brad" <brad(at)cg-soup.com>
>  Subject : RE: Slashing back at RegExp
>  
>  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);
>     ...
>  }
>  
>  
>  ---
>  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.