Results 1 to 2 of 2
Thread: parse simple string with regex?
- 03-01-2011, 11:54 AM #1Member
- Join Date
- Jan 2011
- Rep Power
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!
- 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
- By Romally in forum New To JavaReplies: 4Last Post: 11-14-2010, 09:58 PM
- By Dan0100 in forum New To JavaReplies: 3Last Post: 09-16-2010, 08:45 PM
- By Jack in forum XMLReplies: 4Last Post: 02-22-2009, 04:31 PM
- By raj reddy in forum Java ServletReplies: 10Last Post: 01-09-2009, 07:41 PM
- By raj reddy in forum Threads and SynchronizationReplies: 5Last Post: 06-10-2008, 06:32 AM