Prev | Current Page 415 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

match(???My birthdate is 1972-05-07??™)); // true
trace(re.match(???My birthdate is 1972/05/07??™)); // true
trace(re.match(???My birthdate is 1972 05 07??™)); // true
trace(re.match(???My birthdate is 1972 May 07??™)); // false
}
}
Anchors
Anchors match positions instead of characters; for this reason they do not consume characters
(see Table 8 - 8 ).
Table 8-8
Syntax Description
^ (caret) Matches at the beginning of a string or after a newline. With the m option it matches
only the beginning of the string
$ (dollar) Matches the end of a string or after a newline. With the m option it matches only
the end of the string
\b Matches a word boundary. A word boundary can be the start or the end of a
sequence of \w characters.
The following pattern matches any string that begins with abc ; the rest of the string has no consequences
for the match.
class Main
{
public static function main()
{
var re = ~/^abc/;
trace(re.match(???abcdef??™)); // true
trace(re.match(???defabc??™)); // false
}
}
Part II: Server Side, JavaScript, and Flash; Oh My!
218
It is possible to check both the limits of a test string.


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