aspose file tools
The moose likes Java in General and the fly likes How to abstract a sub-string fro ma string by using Regular Expression? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to abstract a sub-string fro ma string by using Regular Expression?" Watch "How to abstract a sub-string fro ma string by using Regular Expression?" New topic
Author

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

Thomas Chang
Ranch Hand

Joined: May 13, 2008
Posts: 59
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
Sheriff

Joined: Oct 13, 2005
Posts: 32611
    
    4
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

Joined: May 13, 2008
Posts: 59
Thanks. I've solved the problem.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32611
    
    4
Well done Please tell us how, for the benefit of future generations (or tomorrow's readers).
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to abstract a sub-string fro ma string by using Regular Expression?
 
Similar Threads
Twiki Regular Expression
Integer.parseInt()
need a regular expression for extracting strings.
Validating Cron Expression
Regular expression for valid xml