Probably a q for Kem but .....

I have some text with a lot of code snippets where each code snippet is surrounded by code tags like this:

if true
  // do this
  // do that
end if

I can remove the code tags (including leading and trailing spaces) quite easily with

dim rx as new RegEx
rx.SearchPattern = "(?Usi-m) *~~~xojo *\\s*(.*) *~~~ *"
rx.ReplacementPattern = "\\1"

dim rxOptions as RegExOptions = rx.Options
rxOptions.MatchEmpty = false
rxOptions.StringBeginIsLineBegin = false
rxOptions.StringEndIsLineEnd = false
rxOptions.ReplaceAllMatches = true

dim replacedText as string = rx.Replace( sourceText )

However I also want to indent the replaced code with a tab in each line.

Is that possible?
I suppose I might have to do this in two passes rather than a single search & replace ?

Two passes.

^ -> \t