Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

yet another RegExp question

Status
Not open for further replies.

Bong

Programmer
Dec 22, 1999
2,063
US
Greeting.
I have a string of the following form:
"<bunch of white space> MANAGER: <manager's lastname>, <manager's firstname> <initial> <bunch of white space> <Employee's lastname>, <employee's firstname> <initial> Status: <a bunch more stuff I don't care about> "

I want to get the "employee's lastname".

I tried:
line.indexOf("([A-Z]*)(,)(.*)(STATUS:)");
but it didn't work. Any help?


_________________
Bob Rashkin
 
Why everyone likes those ugly regex?

Code:
String yourLongString;
String middleString = yourLongString.split(",")[1];
int lastSpacePos = middleString.lastIndexOf(" ");
String whatImLookingFor = middleString.substring(lastSpacePos +1);

Cheers,
Dian
 
OK. I like it.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top