c# - Regex for: Must contain a numeric, excluding "SomeText1" -


i need regex pattern (must single pattern) match text contains number, excluding specific literal (i.e. "sometext1").

i have match text containing number part:

^.*[0-9]+.*$ 

but having problem excluding specific literal.

update: .net regex.

thanks in advance.

as verbose regex:

^              # start of string (?=.*[0-9])    # assert presence of @ least 1 digit (?!sometext1$) # assert string not "sometext1" .*             # if so, match characters $              # until end of string 

if regex flavor doesn't support those:

^(?=.*[0-9])(?!sometext1$).*$ 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -