String Replace

Post Reply
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

String Replace

Post 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.
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: String Replace

Post 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.
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: String Replace

Post by magnussandstrom »

Thanks Freddy, that solved it! I did try to solve my self with regular expression but didn't get it right. Thanks!
Post Reply