Currently I have this string
"RED-CURRENT_FORD-something.something"
I need to capture the word between the hypens. In this case the word CURRENT_FORD
I have the following written
\CURRENT_.*\B-\
Which returns CURRENT_FORD-
which is wrong on two levels.
CURRENT
Any more efficient way of capturing the words in between the hyphens without explicitly stating the first word?
You can use the delimiters to help bound your pattern then capture what you want with parentheses.
/-([^-]+)-/
You can then trim the hyphens off.