Regex: match a word in a string but only when line doesn't contain a slash -
i want match word in string, when string doesn't contain //
example: match word books
this should match:
i read books
.
this should not match.
// read books
.
to match word, have created regex:
(?<=.)books(?=\s*)
but how ignore strings contains //
?
additional info:
//
in front of word match.//
not @ beginning of string. leading whitespaces possible.i want match word can replace in next step.
i want use in replace in files function of visual studio 2013.
thank efforts.
wiktorstribiżew wrote solution question in comment.
the solution: (?<!//.*?)(books|spoons|shelves)
Comments
Post a Comment