This is about regex in Ruby..
I have a string, that looks like:
“—\n- PARSEFROMHERE anyrthing you can imagine numbers special characters anything ENDPARSEFROMHERE\n PARSEFROMHERE anyrthing you can imagine numbers special characters anything ENDPARSEFROMHERE\n”
How would I match everything in between PARSEFROMHERE ENDPARSEFROMHERE with some regexp?
Thanks!
Try this:
Everything is stored into backreference 1. But if for some magical reason you have “unbalanced” delimiters this regex will fail, miserably.
Edit:
According to your examples PARSEFROMHERE is always preceded-followed by space. Same goes with ENDPARSEFROMHERE but this ends in
\nso I keed the word boundary anchor there..