human
replacing all regex matches in single line
assistant
Here is some code to match string 'this is my string' with regex '\\b(this|string)\\b'
then replace it with regex '<markup>\\1</markup>'

re.sub('\\b(this|string)\\b', '<markup>\\1</markup>', 'this is my string')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.