c# - Failed on building working RegEx Expression -
c# - Failed on building working RegEx Expression -
i'm working on little searching tool, searchs defined words in every (text-based) file in selected filepath.
therefore used build working regex string makes possible , does.
furthermore, added function user can add together strings list, wich should excluded searched word (e.g. searchstring: "result", exlusion:":=", "result:=" in .dfm files should ignored).
my current regex string :
@"(?:(result)(?!:=|;))"
this solution works simple, if there's ":=" or ";" @ end of "result". should allowed other words can stand for- , afterwards "result" till end of line.
can help me? :)
many in advance :)
if understand correctly, you're looking negative lookbehind (?<!)
(?<!@|&)result(?!:=|;)
demo
c# regex
Comments
Post a Comment