User Tools

Site Tools


syntax:functions:regexreplace

RegExReplace(text, replace_text, regex_text)

Category: Text function


Description

This function replaces the first substring within text that matches the regular expression pattern (regex_text) with the given replacement string, replace_text.


Use cases

RegExMatch is useful for fuzzy-matching and replacing substrings of text using a specific pattern of characters.


Arguments

ArgumentTypeDescription
textTextThe text value to test for the regex_text RegEx pattern.
replace_textTextThe text value to replace any text found that matches the regex_text RegEx pattern.
regex_textText (RegEx pattern)The string pattern to search for within text. The first instance of any text matching this pattern
is replaced with replace_text.

Return value type: Text


Remarks

EasyMorph uses the .NET regex language.


Examples

regexreplace('12345678', 'ABCD', '^\d{4}') //Returns 'ABCD5678'
regexreplace('MaryAnne', 'Jo', '[a-zA-Z]{4}') //Returns 'JoAnne'


See also

syntax/functions/regexreplace.txt · Last modified: 2022/05/20 06:56 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki