c# how to write a dot modifier in RegExp? -


private string pattern = @"^.$"; 

the dot not identified modifier, literal string, how idetify modifier?

you forgot add quantifier .:

if want match 0 or more: @"^.*$"

if want match 1 or more: @"^.+$"

don't forget regular expressions greedy default. if want non-greedy, append ? .*


Comments