C# regular expression match pattern with indentation -
i have text file, , want match 3 lines occur 10 times within text file. problem match 3 lines indentation, , third line can words
line example:
something follow found something
this have tried far:
string pattern = @"\s\s\s\sthen([\s\s]*)found(\n|\r|\r\n)(\s\s\s\s\s\s)(.*)"; match = regex.match(input, pattern, regexoptions.multiline);
the result gives me 500 matches, not im looking for.
i'm making wild guesses required format, can try this:
var text = @" something follow found something "; var pattern = @"[ ]{4}then[\w\s]+(\r|\n|\r\n)[ ]{6}[\w\s]+found(\r|\n|\r\n)[ ]{6}[\w\s]+(\r|\n|\r\n)"; var match = regex.match(text, pattern, regexoptions.multiline)
Comments
Post a Comment