I have a couple of lines in a document which looks something like that:
foo-bar-foo[Foo - Bar]
I'd like to select every - character up until the first [ bracket on every line. Thus the - in the square brackets shouldn't be selected.
How can I achieve that with a Regex?
I already have this regex /.+?(?=\[)/g, which selects every character until the first [ but I only want the -.
Edit: I want to replace these selected characters with the sed command (GNU).