My objective is to match a pattern that doesn’t contain ‘#’ before the pattern, for example this:
array = ("# abc", "# abcd" "abc" " abc ", "abcd" "abc # foo")
I want to match “abc”. ” abc” . “abcd” . “abc # foo”
What regular expression do I need so as to match only patterns of ‘abc’ that do not contain ‘#’?
I tried m/[^#]+abc/g but it doesn’t work.
If you don’t want
#anywhere beforeabc, you were almost there. Try this:^[^#]*abc.