I work in Ruby, and have to create a single regexp for the following task, as I'm working with someone else's gem that uses this regexp to match fields to be worked on in a text file. I need to match beginning of string, any set of characters, and underscore, then any multi-digit integer that is not 1,2, 9, or 10, and end of string.
I.e., I want the following to match:
foo_4
bar_8
baz_120
BUT NOT:
foo_1
bar_9
baz_10
I tried
/^.+_(^(1|2|9|10))$/
but it did not work as apparently ^
only "negates" characters in brackets, not submatches.