File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

strings and regular expressions.

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 317
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

Joined: Oct 14, 2005
Posts: 19973

Yes, Java supports regular expressions.
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

I agree. Here's the link:
subject: strings and regular expressions.
It's not a secret anymore!