Created
January 20, 2014 22:14
-
-
Save jsteinshouer/8530344 to your computer and use it in GitHub Desktop.
Coldfusion rereplace example to remove iframes
This file contains 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
<cfsetting showdebugoutput="false"> | |
<!--- Here is some html content with iframes ---> | |
<cfset sOriginalContent = " | |
<h3>Title Here</h3> | |
<pHere is a paragraph</p> | |
<iframe width=""560"" height=""315"" src=""//www.youtube.com/embed/B7UmUX68KtE"" frameborder=""0"" allowfullscreen></iframe> | |
<p>another paragraph</p> | |
<iframe width=""560"" height=""315"" src=""//www.youtube.com/embed/VnT7pT6zCcA"" frameborder=""0"" allowfullscreen /></iframe> | |
<p style=""font-weight: bold"">paragraph 3</p> | |
"> | |
<!--- Use regex to remove iframe tags from content ---> | |
<cfset sNewContent = rereplaceNoCase(sOriginalContent,"<iframe.*?</iframe>","","all")> | |
<!--- Display the original content ---> | |
<h1>Original Content</h1> | |
<cfoutput>#sOriginalContent#</cfoutput> | |
<!--- Display the modified content ---> | |
<h1>Without Iframes</h1> | |
<cfoutput>#sNewContent#</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment