Purpose Replace substrings in a given variable |
Solution 1: Use an intermediate text variable and the ReplaceText command GuiXT
![]() You can specify the new string in hexadecimal notation, e.g. to insert line breaks: GuiXT
![]() Instead of individual characters, you can use any character string to search and replace: GuiXT
![]() Solution 2: Use regular expressions The Set command has the special options regex= and regexReplace=, which allow flexible manipulation of character strings, although there are a few pitfalls to be aware of. GuiXT
![]() Pitfall 1: GuiXT returns an empty string if the regex expression does not match. For this reason, the command Set V[list] "&V[list]" regex="," regexReplace=";" returns an empty string if V[list] does not contain a comma; for example, the string "a" becomes "". You need an intermediate variable and the "if Q[ok]". Regular expressions allow you to search for more than one string at the same time: GuiXT
![]() Pitfall 2: Regular expressions define a series of characters with a special meaning. You must place a backslash in front of these characters so that they are handled as normal characters , otherwise the result may be surprising: |
Components: InputAssistant |