I have a regex here: https://rubular.com/r/3p9WVitnlZQU3i
When pinging the slack API, it converts blockquotes into individual lines with > at the start of each line even if there are multiple lines. I want to wrap them in blockquotes:
Just in case the link expires at some point in the future, here is the test string to be matched:
> This is a blockquote line
testing a new line
> 1- Another new blockquote section
> 2- And this is part of the same blockquote
> And this is the final line of this blockquote
testing another
> 1- Another new blockquote
> 2- And the final line of the 3rd blockquote
And here is the regex
^>.*
The regex works fine and I am trying to use gsub or another method to wrap them in blockquotes so the final result would be:
<blockquote>This is a blockquote line</blockquote>
testing a new line
<blockquote>1- Another new blockquote section
2- And this is part of the same blockquote
And this is the final line of this blockquote</blockquote>
testing another
<blockquote>1- Another new blockquote
2- And the final line of the 3rd blockquote</blockquote>
Or even if that is very difficult, if it just wrapped every line that started with > in blockquote tags that would be fine either as I can just add no bottom margin and they will look like one large quote.
I honestly am a bit lost but I guess I am trying to do something like this:
wrap_in_blockquote = replace_backticks2.gsub('^>.*','<blockquote>/0</blockquote>')
But I have no idea if I need to iterate through the matches individually or this will do that or what syntax I should use as I am not familiar with gsub and struggled with the documentation. Any help appreciated.