I need to make a regex (.net flavour) that matches only "sometext" in the following strings (the second line has a space at the end):
sometext
sometext
sometext dsf 2131
sometext-1234
but won't match anything in the following:
sometext 12
sometext 3
sometext2
sometext-1
That is it should match "sometext" only if it is not followed by any number of optional separator characters (like space, "-", "/", ".") and 1 or 2 digits (3 or more digits are fine).
I tried this regex with negative lookahead
sometext($|\W(?!\d{1,2}))
but didn't get too far.
sometext-123.1orsometext-12.123orsometext-.-/.123. With$you test the end of the input. What if the input doesn't end after three digits?