I need something that will find a word enclosed in two “%” signs, and replace the first % with a [ and the second % sign with a ].
So in the string “This is dummy text %with% percent signs”
It will then make it “This is dummy text [with] percent signs”
EDIT: Would there be a way to search and replace two different things in the same regex? Like I need to replace %blah% with [blah] but also %~dp1 with [~dp1] the %~dp1 call is in the format %~(could be some letters here)(always ends with a single digit thats how you know the call is over) sorry this is the last thing 🙂
I would match the whole substring enclosed by the special characters, and replace it with a string containing the same inner characters but with brackets instead of percent signs. Make sure you use nongreedy matching if the input can have many of these substrings: