b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » XXX » Message 10282578 (Thread)

# For some reason I can never see your images at work :(
As a TJ, are there any Dreamweaver monkeys around who can help me with a 'using regular expressions in search and replace' issue?

I've got onClick='javascript: pageTracker._trackPageview('XXXX');' dotted around thousands of pages of website and I need to replace it with onclick='_gaq.push(['_trackEvent', 'XXXX', '<?=$name_id;?>']);' where the XXXX bit remains the same. Anyone know what the syntax is I need to use? I'm thinking I need to escape a bunch of characters but nothing's working so far :(
(, Tue 14 Dec 2010, 12:02, archived)
# what's in the XXXX bit? just alphanumerics? are they all the same length?
edit

this works for me using regexr (http://gskinner.com/RegExr/desktop/):

match expression: onClick="javascript: pageTracker._trackPageview\('([A-Z]+)'\);"

replace expression: onclick="_gaq.push(['_trackEvent', '$1', '<?=$name_id;?>']);"

presuming that the XXXX bit is 1 or more alphas
(, Tue 14 Dec 2010, 12:33, archived)