Regex - pattern capture everything except for pattern [.net] -
i capture to, not including particular patter. actual problem has parsing out information html, distilling problem down example to, hopefully, clarify question.
source
xaxbxcabcabc
desired match
xaxbxc
if use lookahead expression capture first occurrence
.*(?=abc) => xaxbxcabc
i along lines of negated character class, negated pattern.
.*[^abc] //where abc pattern instead of list giving a, b or c
i using http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx testing
if anchor regex you'll solve problem (+ use of lazy quantifier):
"^.*?(?=abc)"
Comments
Post a Comment