Say I have a few lines:
some50 some51/x some52/y some53/z some510 some511/x some512/y some513/z
I want to check if my string is in the form some + number + anything.
I use the template for this requirement: ^some\d+ , which returns all matches to me.
Now I have a requirement to exclude some of the numbers. For example, I must exclude 51 and 52 from matches. What is the correct expression?
I tried (rather a guess than an attempt that I admit):
^some(\d+|(?!(51|52)))^some((\d+)(?!(51|52)))^some(\d+)^(?!(51|52)))^some(\d+)(?!(51|52)))
but not one of them returns the expected result:
some50 some53/z some510 some511/x some512/y some513/z
PS: I donβt know if this matters, but the regular expression is used in the PowerShell script.
[Change] . Expanded questions to show that 51x should not be ruled out
source share