aspose file tools*
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
Author

Java Regexp API

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
According to Oreilly Learning Java 2nd ed chap 9.6.1.7 (chap 10.7.1.7 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
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes you are right. Must be a typo.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
Consider Paul's rocket mass heater.
 
subject: Java Regexp API
 
Similar Threads
Regular expression to select # in words
[regex] select word of 3 letter and more between other word
Locating data via pattern matching
Regular expression to check for specific special characters (any repitition) and 0 to 9 numbers
Doubt in word boundaries