File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java Regexp API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Regexp API" Watch "Java Regexp API" New topic

Java Regexp API

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
According to Oreilly Learning Java 2nd ed chap (chap for 3rd ed),

\w+@\w+(\.\w)+ // Match an email address

This expression matches a word, followed by an @ symbol, followed by another word and then one or more literal dot-separated words e.g.,,, or

However, I guess it should only match pat@pat.a.b.c.d, friend@foo.b.a.r.c, etc. Am I right?
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Yes you are right. Must be a typo.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Java Regexp API
jQuery in Action, 3rd edition