Perform a regular expresson search and replace

regex:replace(search
, replacement
, subject
, limit: -1)

regex:replace('/a/', 'b', 'abcd')
#=> "bbcd"

# using a callback
regex:replace('/a/', function($matches){ return $matches:0 . '!!'; }, 'abcd')
#=> "a!!bcd"

Copyright ©2013-2022 SunSed®. All rights reserved.