| Programming ActionScript 3.0 > Core ActionScript 3.0 Data Types and Classes > Using Regular Expressions | |||
A regular expression describes a pattern that is used to find and manipulate matching text in strings. Regular expressions resemble strings, but they can include special codes to describe patterns and repetition. For example, the following regular expression matches a string that starts with the character A followed by one or more sequential digits:
/A\d+/
Regular expression patterns can be complex, and sometimes cryptic in appearance, such as the following expression to match a valid e-mail address:
/([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}/
This chapter describes the basic syntax for constructing regular expressions. However, regular expressions can have many complexities and nuances. You can find detailed resources on regular expressions on the web and in bookstores. Keep in mind that different programming environments implement regular expressions in different ways. ActionScript 3.0 implements regular expressions as defined in the ECMAScript edition 3 language specification (ECMA-262).
You can use regular expressions with the following methods of the String class: match(), replace(), and search(). For more information on these methods, see Finding patterns in strings and replacing substrings.
Flex 2.01
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/201/html/12_Using_Regular_Expressions_168_01.html