Search Books

JDK 1.4 Tutorial, eDoc 6 : Understanding and Using Regular Expressions in Java

Author Gregory Travis
Publisher Manning Publications
📄 Viewing lite version Full site ›
🌎 Shop on Amazon — choose country
9.95 USD
🛒 Buy New on Amazon 🇺🇸

✓ Available for download now

Share:
Book Details
ISBN / ASINB00006928T
ISBN-13978B000069283
AvailabilityAvailable for download now
Sales Rank10,333,941
MarketplaceUnited States 🇺🇸

Description

Since the rise of Perl, every computer language suffers from Regular Expression-envy. Well, no more -- JDK 1.4 now comes with a full-featured regex implementation.

This e-doc starts out with a detailed exposition on regular expressions -- what they are, what they are useful for, and how they are implemented within Java. Then, four simple examples are implemented -- first in Perl, and then, identically, in Java. Finally, two more substantial programs, in Java only, round out the tutorial.

This e-doc will show you how to:

  • Understand regular expressions
  • Match strings and substrings against a pattern
  • Pull matched components out of strings

Sample programs included in this chapter: (In both Perl and Java)

  • Find the longest word in a line of text
  • Parse a tab-delimited file
  • A simple command-line interpreter
  • Parsing and inspecting proper names

Other sample program included in this chapter: (Java only)

  • A simple HTML templating system
  • A data-driven lexical analyzer