c# - How to find multiple lines without specific number -


i have these lines:

mystring                 33 mystring                 10 mystring                 3 mystring                 5 

i want match on lines doesn't have specific number: 3.
therefore, need match on these numbers:

mystring                 33 mystring                 10 mystring                 5 

but not on:

mystring                 3 

this tried:

mystring                 ^(?!3) mystring                 ^(3) mystring                 (^?!3) mystring                 (^3) 

but none of them worked.
don't have experience regex.
used website guide:
https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

i read similar questions:
exclude numbers range of numbers using regular expression exclude set of specific numbers in "\d+" regular expression pattern

but still didn't understand how it.

you can use regex

mystring                 (?!3\b)\d+ 

see regex demo

negative lookahead (?!3\b)
assert regex below not match character 3 literally
\b assert position @ word boundary


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -