· Intersection: consists of characters common to all nested classes and matches only common characters. Example: [a-z&&[d-f]] matches characters d, e, and f. The following command line offers a second example:
java RegexDemo [aeiouy&&[y]] party
java RegexDemo [aeiouy&&[y]] party matches y in [aeiou&&[y]] with y in party. No other matches exist.
· Subtraction: consists of all characters except for those indicated in nested negation character classes and matches the remaining characters. Example: [a-z&&[^m-p]] matches characters a through l and q through z. The following command line offers a second example:
java RegexDemo [a-f&&[^a-c]&&[^e]] abcdefg
No comments:
Post a Comment