Results 1 to 2 of 2
Thread: parse simple string with regex?
- 03-01-2011, 11:54 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 8
- Rep Power
- 0
parse simple string with regex?
Hello, am new to java and come from php where we have preg_match_all, but i cant figurout how to do this is java.
I have this String str = "GET /whatever HTTP/1.1";
I want to annalyse this string and return to me what ever is inbetween "GET /" and HTTP
so in this case i whould like to return "whatever"
whatever could be a word or didgets but not a whitespace.
Pleas help me with this!
//Thanks
- 03-01-2011, 12:14 PM #2
You can just use String#indexOf and String#lastIndexOf. You can see explain this methods in Java API class String.
Skype: petrarsentev
http://TrackStudio.com
Similar Threads
-
Trying to parse int from string. Need help please.
By Romally in forum New To JavaReplies: 4Last Post: 11-14-2010, 09:58 PM -
Simple Regex
By Dan0100 in forum New To JavaReplies: 3Last Post: 09-16-2010, 08:45 PM -
Parse XMLfile as String using SAX parser
By Jack in forum XMLReplies: 4Last Post: 02-22-2009, 04:31 PM -
how to Parse int to a string variable
By raj reddy in forum Java ServletReplies: 10Last Post: 01-09-2009, 07:41 PM -
how to Parse int to a string variable (pls hlp)
By raj reddy in forum Threads and SynchronizationReplies: 5Last Post: 06-10-2008, 06:32 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks