String Replace

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

String Replace

Post by JimmyHartington »

Hi

I am trying to use the String Replace app https://www.enfocus.com/en/appstore/pro ... ng-replace to fix/cleanup the HTML of an e-mail received by Switch.

This is a part of the HTML

Code: Select all

  <br><b>Send til:</b>
  <br>Skabertrang
  <br>Jimmy
  <br>Stagehøjvej 27a
  <br>Silkeborg,  8600
  <br>DK
  <br>
  <br><b>Papiromkostninger:  </b>kr. 0,00
  <br><b>Prepress-omkostninger:  </b>kr. 0,00
  <br><b>Trykkeomkostninger:  </b>kr. 0,00
  <br><b>Indbindingsomkostninger:  </b>kr. 0,00
  <br><b>Forsendelsesomkostninger:  </b>kr. 0,00
  <br>
  <br><b>PRODUKTLISTE</b>
  <br>

I am trying to remove the lines with:
Papiromskostninger:
Prepress-omkostninger:
Etc.

I also add a stylesheet at the start of the file.

This is my multiline value in your app.

Code: Select all

</head>=</head><style>  @media print {  @page {  size: 297mm 420mm; margin: 10mm; }  body { margin: 10mm; }}</style>
.*?Papiromkostninger:.*?0,00=

The first line replaces fine.
But on the second line I try to use RegExp to remove the line with Papiromkostninger, but it does not work.

Is there some certain way I need to define the RegExp to get it to work?
User avatar
JimmyHartington
Advanced member
Posts: 278
Joined: Tue Mar 22, 2011 7:38 am

Re: String Replace

Post by JimmyHartington »

I found the answer elsewhere on the forum viewtopic.php?f=13&t=3740&p=11542&hilit ... ext#p11542

So the greedy ? in RegExp is not supported in Switch.

But I the used the {3,180} to define a shorter amount of characters to look for.
Post Reply