I have some text as follows:
381
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
473
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
112
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
And I need to introduce a special character before each number like so:
±381
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
±473
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
±112
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
So far, I’ve managed to get the regex to replace every number with ±, like so:
$Text = $Text.replace (“[±]?\d+(?:.\d+)?”, “±”);
Which works in TBX. However, the following doesn’t work in TBX, but seems to work in Visual Studio Code:
Find: [±]?\d+(?:.\d+)?
Replace: ±$&
I cannot for the life of me figure out how to execute something like this in TBX.
$Text = $Text.replace (“[±]?\d+(?:.\d+)?”, “±”$&);
How do I make TBX realize that in the replace part of the command, ± is text and $& is regex? Please help. Thanks.