ScriptCore3.ReplaceRegExpr

From Soldat Community Wiki
Revision as of 14:38, 25 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
function ReplaceRegExpr(const ARegExpr, AInputStr, AReplaceStr: string; AUseSubstitution: boolean): string
 ARegExpr: regular expression
 AInputStr: string to be altered
 AReplaceStr: replacement for occurencies of ARegExpr
 AUseSubstitution: if TRUE, AReplaceStr will be used as template of the result

Description

Returns AInputStr with r.e. occurencies replaced by AReplaceStr.

If AUseSubstitution is true, then AReplaceStr will be used as template for Result.

Examples

ReplaceRegExpr('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*','BLOCK( test1)', 'def "$1" value "$2"', True)
-->
def 'BLOCK' value 'test1'
ReplaceRegExpr('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*','BLOCK( test1)', 'def "$1" value "$2"', False)
-->
def "$1" value "$2"