httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mayuresh <mayuresh.kshirsa...@gmail.com>
Subject Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response
Date Tue, 22 Nov 2016 19:12:21 GMT
Hi Jason,

Each meta tag is appearing on a separate line. Will it work even then?
Trying it out any ways.

Thanks,
Mayuresh

On Tue, Nov 22, 2016 at 10:41 AM, Jason Brooks <jason.brooks@eroi.com>
wrote:

> Hello,
>
> According to the Apache Glossary page
> <https://httpd.apache.org/docs/current/glossary.html#regex>, it’s all PCRE
> <http://www.pcre.org/> based.  So you should be able to use the
> “non-greedy” match.  So instead of .* which will match all instances, use
> .*?.  If you anchor it at the end of the string, something like (text you
> are matching against).*?$, then you can be certain of getting the last one.
>
> —jason
>
> Jason Brooks Systems Administrator
> eROI Performance is Art.
>
> m: 505 nw couch #300 w: eroi.com
> t: 503.290.3105 f: 503.228.4249
>
>
> fb: fb.com/eROI <http://www.facebook.com/eROI>
>
>
>
>
>
>
>
>
> On Nov 22, 2016, at 8:50 AM, Mayuresh <mayuresh.kshirsagar@gmail.com>
> wrote:
>
> Hi,
>
> How can I check for the last occurrence of a string in the response html
> and only replace the last occurrence of it?
>
> I want to search for the last "meta" tag in the response and replace it
> with something.
>
> How can I do this?
>
> Thanks,
> Mayuresh
>
>
>


-- 
-Mayuresh

Mime
View raw message