Re: Mod_Substitute - Match the last occurrence of a string in the response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am able to modify the response. The problem is it is happening per line. so with something like this:

Substitute "s|(.*<meta [^>]*>)|$1<script>window['start-time'] = new Date().getTime();</script><script src="">


It is doing the replacement for all the meta tags in the html. I just want it to happen for the last occurrence.


James, I tried your suggestion, but it works for all the lines.


On Tue, Nov 22, 2016 at 9:51 AM, bob gailer <bgailer@xxxxxxxxx> wrote:
On 11/22/2016 11:50 AM, Mayuresh 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.
Sorry - I just noticed Mod_Substitute in your subject

Check https://serverpilot.io/community/articles/how-to-use-apache-to-replace-strings-in-responses.html

It points to http://httpd.apache.org/docs/2.4/mod/mod_substitute.html.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




--
-Mayuresh

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux