This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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

Win a copy of Elasticsearch in Action this week in the Big Data forum!
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: 19351

Yes, Java supports regular expressions.
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

subject: strings and regular expressions.