Hi everyone,
Ive built an email marketing tool and have found that some users when editing the content via the FCK editor they enter in additional parameters. IE = Target class style etc.
I currently only want the application to process the href="" content only with the output contining the URL so i can process it into my database to build a tracking URL.
Regular expressions are what i am using to edit the content transparently to the user however it is still returning the additional tag parameters.
below is my code
<cfsavecontent variable="arguments.pageContent">
<p><a target="_self" id="testID" name="myTest" lang="EU" accesskey="1" tabindex="1" title="test title" type="my content" charset="UTF-8" class="testClassName" style="testStyle sheet" href="http://www.facebook.com"><img width="1047" height="583" alt="" src="/siteMediaFiles/CELEBRITY%20COLLECTION%20HOME%20PAGE.jpg" /></a> <a onclick="window.open(this.href,'','resizable=yes,location=yes,menubar=yes,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,status'); return false" href="http://www.google.com"><img width="793" height="481" alt="" src="/siteMediaFiles/Artisan-Riad-EMAIL.jpg" /></a><a target="_blank" href="http://www.gmail.com"><img width="289" height="609" alt="" src="/siteMediaFiles/BANNER.jpg" /></a></p>
</cfsavecontent>
<cfset matches = reMatch("<[aA].*?>.*?</[aA]>",arguments.PageContent)>
<cfset mylinks = arrayNew(1)>
<cfloop index="a" array="#matches#">
<cfset myURL = rereplace(a, '">.*?</a>',"","all")>
<cfset myURL = rereplace(myUrl, '<a.*href="',"","all")>
<cfset arrayAppend(myLinks,myURL)>
</cfloop>
<cfdump var="#myURL#">
<cfdump var="#myLinks#">