I have a list of strings. Some of them are of the form 123-...456. The variable portion \"...\" may be:
123-...456
Update: Thanks to Germán Rodríguez Herrera!
In javascript try: /123-(apple(?=-)|banana(?=-)|(?!-))-?456/
/123-(apple(?=-)|banana(?=-)|(?!-))-?456/
Remember that the result is in group 1
Debuggex Demo