I want to isolate ex. 3 word into long text
//more text
word word word (15:00 - - - 16:00 - - - 21:00)
//text ...
At this point i want to isolate times into parenthesis with a regex expression but i want to return in this format 15:00,16:00,21:00
i have tried with 3 strings '\).*' replace with ' '
'.*\(' replace with ' '
and '---' replace with ', '
the problem is, that there may be other brackets in the text, and then it won't work like here:
(word) word word (19:00 - - - 20:00 - - - 21:00) asd asd asd (text text)
I'm limited to replace-operations because yahoo pipes is not a programming language.
So you are limited to doing replace-operations? Because extraction would make more sense here.
The requirements and variables aren't very clear. Apparently (from the comments) there could be parentheses in front of and behind the one you wanna keep. Are there only ever 3 times? Or possibly 2 or 4?
This version assumes there are always 3 times in the parentheses you wanna keep, everything else in front of it gets captured.
^(?:[^(]|\((?!(?:\d{1,2}:\d{2}[\s-]*){3}))*\(
So this regex select everything up to the times by saying "match start of the line, then everything that isn't a (
or a (
that isn't followed by 3 time-notations with only whitespace (\s
) and/or -
between them"
After that you can do:
'\).*' replace with ''
'[\s-]+' replace with ', '