Currently I have this string:
"RED-CURRENT_FORD-something.something"
I need to capture the word between the hyphens. In this case the word CURRENT_FORD.
I have the following written:
\CURRENT_.*\B-\
Which returns CURRENT_FORD- which is wrong on two levels.
- It implies that everything between hyphens starts with
CURRENT. - It includes the hyphen at the end.
Is there a way to capture 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.