Link to home
Start Free TrialLog in
Avatar of jay28lee
jay28lee

asked on

How do I add/replace Google Analytics code using regular expression?

Google Analytics code contains special symbol such as quotation and semicolon marks.

I'm using Perl to dynamically update and replace certain content of my html template to generate static page.  For specific purpose, I can't simply just add the tracking code to the html page.

I would like to use regular expression to match for </head>

and then append the Google Analytics code before the closing </head>

How can this be done?
ASKER CERTIFIED SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jay28lee
jay28lee

ASKER

how do i assign a piece of code to a variable with special symbol of quotation and semicolon marks?