Sv RegexReplace
Revision as of 08:45, 8 June 2016 by imported>Jazzisparis (Created page with "{{Function |origin = JIP |summary = Returns a copy of the specified '''string_var''', with all matches to the specified [http://en.wikipedia.org/wiki/Regular_expression Regu...")
< [[::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 | - replacement|pattern (see example, below).
Syntax
(modifiedSeq:string_var) sv_RegexReplace targetSeq:string_var replacement|pattern:formattedString formatVars
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!".
Notes
- regEx supports string formatting, and up to 20 variables may be used.