• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to abstract a sub-string fro ma string by using Regular Expression?  RSS feed

 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assumed I have a string as follow:

"ÖÄÖÜ Stand:¶Œ **üü 12.02.2009ÿÂ"

What I want is, I want to abstract the date "12.02.2009" from this string. I guess one can do this in a simple way by using Regular-Expression.

Has someone idea?

 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To the Java Tutorials!! Look at the Matcher and Formatter classes. You can probably write a regex like (\\d{2}\\.){2}\\d{4} or something similar and find where it matches. You will have to check in the tutorial or similar to see whether I have got it right.
 
Thomas Chang
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I've solved the problem.
 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done Please tell us how, for the benefit of future generations (or tomorrow's readers).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!