From the following string
ar-101 "ar102" ar103 "ar-104" ar-105 "ar-106"
I only want to match the words that don’t start or end with quotes and have a dash between two words. So from the string I want to match ar-101 & ar-105
This is my regex so far, but it matches the words between quotes as well
\b\w+[-]\w+(?<!")\b
>Solution :
You’ve got it almost alright, just put your look behind at the start of the expression.
\b(?<!")\w+[-]\w+\b