I would need a regex to extract ‘Fred’ (identified as user) from a string like
var s='city(NewYork)country(USA)user(Fred)age(30)'
tried this not working
s.match(/(user\()\w+/)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Move the parens. Unless you’re 100% certain that
sis a string, you should prefer/.../.exec(string)overstring.match(regex).Demo: http://jsfiddle.net/3S6cV/