Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-23 Thread Nick Kew
On Wed, 2016-11-23 at 09:25 +, Dr James Smith wrote: > Why are you attaching after the last meta tag - wouldn't it be easier > just before the tag or just after the tag - you should > have no other js in the header - except possibly an HTML 5 shim... A is of course optional (implied if not

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-23 Thread Nick Kew
On Tue, 2016-11-22 at 11:32 -0800, Mayuresh wrote: > Is there a way to make a 2 pass substitution? 1st one removing all the > \n's and then using another one to substitute the string that I want? How big are your pages? If not too big, it would be simpler just to set no line-end and parse as a si

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-23 Thread Dr James Smith
Why are you attaching after the last meta tag - wouldn't it be easier just before the tag or just after the tag - you should have no other js in the header - except possibly an HTML 5 shim... On 23/11/2016 08:08, Mayuresh wrote: Any suggestions? On Nov 22, 2016 11:32 AM, "Mayuresh"

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-23 Thread Mayuresh
Any suggestions? On Nov 22, 2016 11:32 AM, "Mayuresh" wrote: > Is there a way to make a 2 pass substitution? 1st one removing all the > \n's and then using another one to substitute the string that I want? > > On Tue, Nov 22, 2016 at 11:15 AM, Mayuresh > wrote: > >> Hi Jason, >> >> I tried it:

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Mayuresh
Is there a way to make a 2 pass substitution? 1st one removing all the \n's and then using another one to substitute the string that I want? On Tue, Nov 22, 2016 at 11:15 AM, Mayuresh wrote: > Hi Jason, > > I tried it: > > Substitute "s%(]*>).*?$%$1window['start-time'] = new > Date().getTime();w

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Mayuresh
Hi Jason, I tried it: Substitute "s%(]*>).*?$%$1window['start-time'] = new Date().getTime();window['app-key'] = \"xxx\";%i" However it still replaces each line that the meta tag appears on. Regards, Mayuresh On Tue, Nov 22, 2016 at 11:12 AM, Mayuresh wrote: > Hi Jason, > > Each meta tag i

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Mayuresh
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 wrote: > Hello, > > According to the Apache Glossary page > , it’s

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Jason Brooks
Hello, According to the Apache Glossary page , it’s all PCRE 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

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Mayuresh
Hi, I am able to modify the response. The problem is it is happening per line. so with something like this: Substitute "s|(.*]*>)|$1window['start-time'] = new Date().getTime();|i" It is doing the replacement for all the meta tags in the html. I just want it to happen for the last occurrence.

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread bob gailer
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 y

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread bob gailer
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. Hi. I am new to Apache, so my questions an

Re: [users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Dr James Smith
Never used mod_substitute - but the standard PCRE way is s/(.*)>/$1/mxs - the .* will capture greedily - so captures all but last meta... On 22/11/2016 16:50, Mayuresh wrote: Hi, How can I check for the last occurrence of a string in the response html and only replace the last occurrenc

[users@httpd] Mod_Substitute - Match the last occurrence of a string in the response

2016-11-22 Thread Mayuresh
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