• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Regex question  RSS feed

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to match empty space in a string, only last one works. Do you have any clues ?



Another question is , what is difference between matcher.find() and matcher.matches() . In the code above, only find() will work.

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider this code.



The difference between matches and find is that matches attempts to match the entire input with the Pattern. find looks for regions that match.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!