File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.util.Matcher help please!

 
Mark Baldwin
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

java.util.regex.Matcher doesn't seem to be working the way I want it to work:



Expected output:



Output:



What's up with this?
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you've got the .* at the beginning and end, the pattern will match against the entire string. Maybe a simpler expression like "@([a-zA-Z_0-9]*)@" would do what you want?
 
Mark Baldwin
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It did. Thanks friend. Regexp isn't my forte
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic