Prev | Current Page 412 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


\n \r \t Matches a newline, a carriage return, and a tab character respectively.
Some characters assume a special meaning when positioned in a specific position of the pattern (see
Table 8 - 6 ); when you have to match the symbol and not use its special meaning, you have to escape the
character with the backslash \ prefix. Note that if you use the regex special syntax, the slash character /
must also be properly escaped; this character has no special meanings in the pattern definition but it is
used as a terminator for the regular expression.
Part II: Server Side, JavaScript, and Flash; Oh My!
216
In the following example, a character class is used to define a pattern that matches any phrase that
contains one vowel:
class Main
{
public static function main()
{
var re = ~/[aeiou]/;
trace(re.match(???haXe??™)); // true
trace(re.match(???xxx??™)); // false
}
}
In the character class the dash symbol ( - ) can be used to create ranges of values. In this case, the pattern
matches any phrase that contains two hexadecimals in sequence.


Pages:
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424