Prev | Current Page 413 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The pattern is used in case - insensitive
mode because of the applied i modifier.
class Main
{
public static function main()
{
var re = ~/[0-9a-f][0-9a-f]/i; // same as ~/[0-9a-f]{2}/i;
trace(re.match(???FF??™)); // true
Table 8-7
Syntax Description
^ Used as the first character in a character class, it negates the expression; otherwise, it
acts normally. So this pattern [^ab] means any character that is not an ???a??? or a ???b,??? but
this [~^] means that only the characters ???~??? and ???^??? are a valid match.
- Used inside a character class and between two other characters, it defines a range; used
as the first character of or outside a character class, it acts normally. The pattern [a-e]
means any character between ???a??? and ???e??? included, [-./] means one of ???-???, ???.??? or ???/???.
\d A character set for every numeric character (digit). Equivalent to [0-9].
\w Any word character; a word character is any letter or number. Equivalent to [a-zA-Z0-
9_] (note that the underscore character is included in the word characters).


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