I need to capture everything between "-" characters.
For example:
Example 1: vivo - La reina soy yo
I need: La reina soy yo
.
Example 2: VOD - Te volveré a encontrar - Temporada 1 - Cap 23
I need: Te volveré a encontrar
.
I've this regex, that is only working for example 1 cases:
REGEXP_EXTRACT(Etiqueta de evento, ".*\\- (.*) ?\\-?")
Google documentation for REGEXP_EXTRACT here
What I need to change, so it works for string like example 2?
It should return what is highlighted in green, not in yellow.
You need to use
REGEXP_EXTRACT(Etiqueta de evento, "^.*? - (.*?)(?: - |$)")
See the regex demo.
Details
^
- start of string.*?
- any 0 or more chars other than line break chars, as few as possible -
- a -
string(.*?)
- Capturing group: any 0 or more chars other than line break chars, as few as possible(?: - |$)
- a non-capturing group matching either -
or end of string.