|
|
|
|
RegexReplace (Function) In french: RegexRemplace Replaces all the parts of a string that follow a specific format. // Replace all dates in DD/MM/YYYY format with dates in MM/DD/YYYY format sString is string sString = "The order will be delivered between 28/08/2020 and 02/09/2020." Â sString = RegexReplace(sString, "([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", "$2/$1/$3") // sString contains "The order will be delivered between 08/28/2020 and 09/02/2020".
s is string = "aaa" + Charact(10) + "bbb" + Charact(13) + Charact(10) + ... "ccc" + Charact(13) + Charact(10) + "ddd" + Charact(10) + "eee" + Charact(13) + "fff" Â Trace(s) Â s2 is string = RegexReplace(s, "(.*)([^\n])\r(.*)", "$1$2" + ... Charact(13) + Charact(10) + "$3") Â Trace(s2)
Syntax
<Result> = RegexReplace(<Initial string> , <Format> , <Replacement string>)
<Result>: Character string String in which the replacements were made. <Initial string>: Character string String in which the replacements are to be made. <Format>: Character string Regular expression that indicates the format of the part of the string to be replaced. <Replacement string>: Character string String that will replace all the parts of the initial string that follow the given format. Remarks - The specification used for regular expressions is ECMAScript.
- You can retrieve a part of a string to use it in the replacement string (see example). In this case:
- '$&' corresponds to the whole found string.
- '$1' corresponds to the first part of the found string.
- '$2' corresponds to the second part of the found string.
- '$n' corresponds to the nth part of the found string.
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|