re: regular expression escaping

by makc3d forked from regular expression escaping (diff: 3)
♥1 | Line 16 | Modified 2011-04-27 17:27:13 | MIT License
play

ActionScript3 source code

/**
 * Copyright makc3d ( http://wonderfl.net/user/makc3d )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/672D
 */

// forked from wh0's regular expression escaping
package {
    import com.actionscriptbible.Example;
    import flash.utils.describeType;
    public class FlashTest extends Example {
        
        public function FlashTest() {
            // Use a regular expression to find \u0064
            
            // something like this:
            var re:RegExp = /\\[u]{1}0064/;
            
            trace('source: ' + re.source);
            
            var str1:String = '\\u0064';
            trace('test string 1: ' + str1);
            trace('should be \\u0064: ' + re.exec(str1));
            var str2:String = 'foo5bar';
            trace('test string 2: ' + str2);
            trace('should be null: ' + re.exec(str2));
        }
        
    }
}