Sv RegexReplace
Jump to navigation
Jump to search
< [[::Category:Functions|Category:Functions]]
A function added by the JIP NVSE Plugin.
Description
Returns a copy of the specified string_var, with all matches to the specified Regular Expression pattern replaced by the specified string.
The replacement and pattern are both passed as a single formatted string, separated by a |, i.e. replacement|pattern (see example, below).
Syntax
(modifiedSeq:string_var) sv_RegexReplace targetSeq:string_var replacement|pattern:formattedString formatVars(up to 20)
Example
let sTargetSeq := "This subject has a submarine as a subsequence" let sModifiedSeq := sv_RegexReplace sTargetSeq "blip!|\b(sub)([^ ]*)"
In the above example, every whole word in sTargetSeq that begins with the sequence "sub" is replaced by "blip!". The result sModifiedSeq is assigned the string "This blip! has a blip! as a blip!".