Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Regular expressions simplify pattern-matching code

Discover the elegance of regular expressions in text-processing scenarios that involve pattern matching

  • Print
  • Feedback

Page 8 of 16

  • 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
    


    java RegexDemo [a-f&&[^a-c]&&[^e]] abcdefg matches d and f with their counterparts in abcdefg. No other matches exist.

    • Print
    • Feedback

    Resources