This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular expression

 
Kev D'Arcy
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a String like below:

me@my.com|ClientId=12345|GUID=klsLDFjlSf09SDf9|KeygenLoc=APPLIANCE|

How can I parse out the Client ID (i.e. the "12345" on its own) value via a regular expression?

Many thanks!
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need a regex?
Try myString.substring(myString.indexOf("ClientID=") + "ClientID=".length(), myString.indexOf("|GUID"));

Try getting the () paired off correctly!
 
Kev D'Arcy
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yip, needs to be a regex!
 
Henry Wong
author
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kev D'Arcy:
Yip, needs to be a regex!


What have you tried so far? It is pretty straightforward -- can be done with a single method call.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic