c# - Regex On Text Producing Empty Value -
c# - Regex On Text Producing Empty Value -
i trying utilize regex on line of text values of name=.
var match = regex.match(textr, @"\bname='([^']*?)'");
the value of textr in question
$mpelement[name="system.workitem.incident.queue.tier2.unassigned.view.header_id"]$
but brings {}
do this:
resultstring = regex.match(yourstring, @"(?<=name="")[^""]+").value;
the lookbehind (?<=name=")
ensures preceded name="
the negative character class [^"]
matches character not double quote the +
quantifier matches such chars 1 or more times c# regex
Comments
Post a Comment