Regex Matches Dynamic Number -
i have following regex:
regex expd = new regex("<ns6:userid>(?result>.*?)</ns6:userid>");
how can handle number 6
changing single digit? after software updates, number may change 0-9
.
i have tried \d
, .
no luck.
thanks!
if regex constructed string, have escape backslashes, \d
become \\d
:
regex expd = new regex("<ns\\d:userid>(?result>.*?)</ns\\d:userid>");
you did not mention language, critical when providing code. i'd that's java, can't know sure.
furthermore, what's (?...)
supposed be? (debuggex doesn't recognise it.) did mean (?:...)
, i.e. non-capturing group?
guess you're looking this:
regex expd = new regex("<ns\\d:userid>(?:result>.*?)</ns\\d:userid>");
but if tried .
, didn't work, either you're using regex implementation highly incompatible rest of world, or you're applying wrong.
Comments
Post a Comment