File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes strings and regular expressions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "strings and regular expressions." Watch "strings and regular expressions." New topic
Author

strings and regular expressions.

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 314
I am given the the following string that I need to process.

frame= 71 fps= 0 q=32.0 size= 12kB time=1.93 bitrate= 50.2kbits/s dup=0 drop=69

I need to grab the text after "time=" In perl I remember being able to easily grab the word or words after the matched pattern.

Does Java support such a feature?

If I split the stirng, "time=XXXX" does not consistantly appear in the same position in the string array. There has to be some simple way extract the word that follows "time="


CIAO Peter M. Cooke
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, Java supports regular expressions.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

String.split()
String.replaceAll()
java.util.regex.Pattern
java.util.regex.Matcher
 
Don't get me started about those stupid light bulbs.
 
subject: strings and regular expressions.