RegEx Help
Hello,
I have the following function:
<cffunction name="stripHREFs" access="public" returntype="array" output="no" hint="seperate Links from given HTML string, output as a array">
<cfargument name="html" required="yes">
<cfset local.startpos = 1>
<cfset local.list = ArrayNew(1)>
<cfloop condition="local.startpos GREATER THAN 0">
<cfset local.linkpos = reFindNoCase('<a\b[^>]*>(.*?)</a>',arguments.html,local.startpos,'true')>
<cfif val(local.linkpos.len[1])>
<cfset local.startpos = local.linkpos.len[1]+local.linkpos.pos[1]>
<cfset local.string = mid(arguments.html,local.linkpos.pos[1],local.linkpos.len[1])>
<cfset local.hrefpos = reFindNoCase('(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+##]*[\w\-\@?^=%&/~\+##])?',local.string,1,'true')>
<cfif val(local.hrefpos.pos[1])>
<cfset local.this.a = mid(local.string,local.hrefpos.pos[1],local.hrefpos.len[1])>
<cfset local.this.title = reReplacenocase(local.string,'<a\b[^>]*.>',"")>
<cfset local.this.title = reReplacenocase(local.this.title,'</a*>',"")>
<cfset ArrayAppend(local.list,local.this)>
<cfset StructDelete(local,'this')>
</cfif>
<cfelse>
<cfbreak>
</cfif>
</cfloop>
<cfreturn local.list>
</cffunction>
It works great, except now my client has decided to include links with an additional attribute called "alias"
The code looks like this, <a href="http://www.acme.com" alias="foo">click me</a>
How can I pull out the "alias" attribute?
TIA
