Page 1 of 1

String Replace

Posted: Sun Dec 05, 2021 10:21 pm
by magnussandstrom
Hi, I am trying to replace a string in a txt-file with the app String Replace.

Incoming:
helloworld<mailto:name@domain.com></email>

Wanted result:
helloworld</email>

The email adress is variable, so what I would like to do is:
<mailto:*></email>=</email>
but that doesn't work with the String Replace app.

Any suggestions how to solve this?

ps.I don't have the scripting module, only the metadata module.

Re: String Replace

Posted: Mon Dec 06, 2021 8:50 am
by freddyp
I have not tried but the documentation of the app says that the replace part can be a regular expression and the regex in this case should be:

Code: Select all

<mailto\:.+><\/email>
I have the impression you were thinking in terms of wildcards, but regular expressions are different. <mailto:* in your regex is interpreted as <mailto followed by a colon 0 or multiple times. In the above example the interpretation is <mailto: followed by any character 1 or multiple times.

Re: String Replace

Posted: Mon Dec 06, 2021 9:30 am
by magnussandstrom
Thanks Freddy, that solved it! I did try to solve my self with regular expression but didn't get it right. Thanks!