开发者

Extract values from URls using regular expression

I have the following Pattern

http://abc.com/#!/[0-9a-z]
http://abc.com/#!/search/%2开发者_StackOverflow社区3[^.]

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜