harshit
harshit

Reputation: 7951

Extract values from URls using regular expression

I have the following Pattern

http://abc.com/#!/[0-9a-z]
http://abc.com/#!/search/%23[^.]

So the first pattern identify the URL of a user and second URL identifies search parameters.

I can check whether the pattern belongs to user or search query using Pattern and Matcher class in Java. How can i extract the values of user or search term?

Upvotes: 0

Views: 137

Answers (1)

zacheusz
zacheusz

Reputation: 8842

You should use capturing group. Look at Java regular expressions: capturing groups for details.

Upvotes: 2

Related Questions