var aText:String = "C:\\folder\\folder\\file";
var filterVal:String = aText.toLowerCase().replace( /\//g, '/');
t开发者_高级运维race( aText );
trace( filterVal );
results as:
C:\folder\folder\file
c:\folder\folder\file
this code was based on this site and nascent regex skills.
What am I doing wrong? Thank you.
you are doing it wrong, what you seem want \is:
var filterVal:String = aText.toLowerCase().replace( /\\/g, '/');
The initial and ending '/' delimit the Regular Expression. What is inside (\\) is what you are searching for. Since it's a backslash, you need to escape it.
精彩评论