Prev | Current Page 414 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


\s Matches any whitespace character; whitespace characters are the single space (ASCII
32), the tab (ASCII 9), the newline (ASCII 10), and the carriage return (ASCII 13).
\D Any non-digit (\d) character.
\W Any non-word (\w) character.
\S Any non-whitespace (\s) character.
. Any character but carriage return (\r) or newline (\n). With the s option in the EReg
constructor also allows to match \r and \n. The pattern j..n means any sequence that
contains a ???j??? followed by any two characters and followed by an ???n???; so that ???john???
and ???jean??? match the pattern but not ???jane.???
Chapter 8: Cross Platform Tools
217
trace(re.match(???0F??™)); // true
trace(re.match(???0g??™)); // false
}
}
Character sets avoid repeating the same definition many times. In this case, a sequence corresponding
to a numerical expression for a date is used as expression. The \W represents any non - alphanumeric
character.
class Main
{
public static function main()
{
var re = ~/\d{4}\W\d{2}\W\d{2}/;
trace(re.


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