Ok so basically I have a string that looks like this
“this is random text [this is random too] [another random text] hey ho [random bar]”
I want the output to be
“this is random text [[this is random too]] [[another random text]] hey ho [[random bar]]”
So basically find every [ and append an [ to it and same for the ]
What would be the best way to do this? Thanks.
Sounds like:
to me… no need for a regular expression at all.
That is assuming you don’t need to worry about brackets which are already doubled, of course.