Regex works outside pipe but not inside - how can I proceed?

After having done some manipulation in a pipe, I can end up with the following empty link and image source (which I want to replace with nothing, i.e. remove:

<a><img alt="" style="<width:16.66%;>" title=""></a>

Using RegExr.com I can see that the following matches it just fine


...but when I use that in the pipe where the empty link and image source are, it doesn't match - or doesn't do the replace.

What can I do to force the match and replace?

I haven't given a pipe link because this happens so rarely that it's almost impossible to see happen in the first place!

6 Replies
  • hello,

    try \> and \< instead of their backslash-less equivalents, I noticed that it helps.

  • Thanks Lolo, I'll give that a try :)

  • Ah, no, it didn't :(

    I'll approach it differently. Thanks anyway, Lolo.



  • I only had a quick look yesterday. looking at your expression now, I have some information for you: in an xml file (hence a feed) the content < and > are replaced by &lt; and &gt; to not interfere with the functional ones. However the pipe regex might interpret those codes. Does the current regex matches up to the img's > ?

  • Hey Lolo, thanks for the added info. My workaround worked out (different approach entirely!) but I may need to look at this again in the future.

    I did have a brief look into the < > but no joy. And, yes, the regex matched all the way to the image's >

  • & lt; & gt; !


Recent Posts

in Pipes