Created
November 20, 2025 16:50
-
-
Save trycf/3bde6a360b7514b662b5a6a01f0b71ae to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cffunction name="extractMetaContent" access="private" returntype="string"> | |
| <cfargument name="emailBody" type="string" required="true"> | |
| <cfargument name="metaName" type="string" required="true"> | |
| <!--- Try double quotes first - handle variable spacing and closing tag variations ---> | |
| <cfset var pattern = '(?i)<meta\s+name="?' & arguments.metaName & '"?\s+content="([^"]*)"[^>]*>'> | |
| <cfset var result = ReFindNoCase(pattern, arguments.emailBody, 1, true)> | |
| <!--- If not found, try single quotes ---> | |
| <cfif ArrayLen(result.pos) lt 2> | |
| <cfset pattern = "(?i)<meta\s+name=""?" & arguments.metaName & """?\s+content='([^']*)'[^>]*>"> | |
| <cfset result = ReFindNoCase(pattern, arguments.emailBody, 1, true)> | |
| </cfif> | |
| <cfif ArrayLen(result.pos) gt 1> | |
| <cfset var content = Mid(arguments.emailBody, result.pos[2], result.len[2])> | |
| <!--- Clean up any remaining encoding ---> | |
| <cfset content = Replace(content, "=3D", "=", "All")> | |
| <cfreturn content> | |
| <cfelse> | |
| <cfreturn ""> | |
| </cfif> | |
| </cffunction> | |
| <cfset email = ' | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Congratulations! You just received a new lead - Seller Lead</title> | |
| <meta name="lead_information_version" content="1.0" /> | |
| <meta name="lead_source" content="Listings-to-Leads" /> | |
| <meta name="lead_type" content="Seller" /> | |
| <meta name="lead_name" content="Sparsh Listings" /> | |
| <meta name="lead_email" content="[email protected]" /> | |
| <meta name="lead_phone" content="N/A" /> | |
| <meta name="lead_property_address" content="728 Duncan St,San Francisco, CA" /> | |
| <meta name="lead_message" content='Property Address: 728 Duncan St,San Francisco, CA, Unit / Apt. #: N/A, Landing Page Location:PVP Testing, Lead's IP Address - 202.131.123.10' /> | |
| <meta name="lead_report" content="Yes" /> | |
| <meta name="lead_features" content="N/A" /> | |
| <meta name="lead_IP" content="202.131.123.10" /> | |
| <meta name="lead_tag" content="PVP Testing" /> | |
| <meta name="lead_tag" content="Property Valuation PLUS" /> | |
| <meta name="lead_tag" content="Seller" /> | |
| <meta name="lead_tag" content="L2L-Seller" />'> | |
| <cfset test = extractMetaContent(emailbody=email,metaName="lead_email")> | |
| <cfdump var="#test#"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment