jQuery in Action, 3rd edition
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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., pat@pat.net, friend@foo.bar.com, or mate@foo.bar.co.uk.

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: http://aspose.com/file-tools
subject: Java Regexp API
It's not a secret anymore!