ActionScript 3 now supports regular expressions! The implementation is much like the one used in JavaScript. You can create new regexp patterns with the RegExp class constructor (top level) and a string or using the literal text format (defined like a string only replacing quotes with a forward slash (/). Ex:
ActionScript Code:
var reCon:RegExp = new RegExp("\\w+", "i");
var reLit:RegExp = /\w+/i;
RegExp methods include:
- RegExp.exec()
- RegExp.test()
String methods that work with regular expressions include:
- String.match()
- String.replace()
- String.search()
0 评论:
发表评论