java - Regex how to get everything apart from the first character -
this question has answer here:
- how access matched groups in javascript regular expression? 15 answers
- java matches group of regex 2 answers
this string
username=john903?fullname=john&smith
this regex far
=([^?]*)
i trying capture "john903"
however returns "=john903"
javascript: (originally question tagged javascript)
the regex have captures value want, returns array. match without equal sign in second element of array:
var str = "username=john903?fullname=john&smith".match(/=([^?]*)/)[1] //str "john903"
java: (op commented in fact using java)
string line = "username=john903?fullname=john&smith"; pattern pattern = pattern.compile("=([^?]*)"); matcher matcher = pattern.matcher(line); system.out.println(matcher.group(1));
Comments
Post a Comment