Prev | Current Page 410 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The pattern
is compared to that string character by character always in forward direction. Every character that is
matched against the pattern is ??? consumed ??? and it is no more reused in the match; there are exceptions to
this rule as explained later on. If one correspondence in the test string is found, the match process is
interrupted and the method returns true ; if the last character of the test string has been examined and
no matches have been found, the function returns false .
Chapter 8: Cross Platform Tools
215
If you instantiate an EReg object using the standard constructor, you may find confounding the use of
the backslashes because they are both used to escape the special characters in the regex patterns and to
escape the string literal values as described in ??? The Simple Value Types ??? section of Chapter 3 . The backslash
in the example has no special meanings in the regex pattern and it is used only to create a valid
string literal.
var re = new EReg(???a\???b???, ???i???);
Character Classes and Sets
Matching for only one character is useful but often limited; character sets and character classes are a
way to instantly define wide ranges of symbols (see Table 8 - 7 ).


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