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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 310
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: 16483
    
    2

Yes, Java supports regular expressions.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 5844
    
    5

String.split()
String.replaceAll()
java.util.regex.Pattern
java.util.regex.Matcher
 
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: strings and regular expressions.
 
Similar Threads
Reverse the words in a string
Obtaining data from form elements
Quotes
Making a binary to decimal converter
Garbage Collection question