Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Regexp API

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right. Must be a typo.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic