Regex to find substring between two strings -
i'd capture value of initial catalog in string:
"blah blah initial catalog = mycat'"
i'd result be: mycat
there or not spaces before , after equal sign , there or not spaces before single quote.
tried , various others no go:
/initial catalog\s?=\s?.*\s?\'/ using .net.
this nice regex
= *(.*?) *' use idea , add \s , more literal text needed.
in c# group 1 contain match
string resultstring = null; try { regex regexobj = new regex("= *(.*?) *'"); resultstring = regexobj.match(subjectstring).groups[1].value; } catch (argumentexception ex) { // syntax error in regular expression }
Comments
Post a Comment