Sv RegexReplace

From the Fallout3 GECK Wiki
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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 | - replacement|pattern (see example, below).

Syntax

[help]
(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

See Also