EasyCFM.COM ColdFusion Forums / .NET to CFML / VB.net to CFML for RegEX

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: VB.net to CFML for RegEX

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

cf-newbie
06-14-2007 @ 3:19 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 23
Joined: May 2007

I need help converting this vbscript to CFML.

For your the <h2> replacement (shown in VBSCRIPT):
<%
Set regEx = New RegExp
regEx.Global = True
regEx.IgnoreCase = True
regEx.MultiLine = True
htmlsource = "your html string in the above example"
regEx.Pattern = "<p class=""bodysub"">(.*?)</p>"
replacementstring = "<h2>$1</h2>"
teststring = regEx.Replace(htmlsource,replacementstring)
%>


Webmaster
06-14-2007 @ 5:26 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

<cfscript>
  htmlsource = "your html string in the above example";
  teststring = REReplaceNoCase(htmlsource, "<p class=""bodysub"">(.*?)</p>", "<h2>$1</h2>", "ALL");
</cfscript>

then you would have a variable: #teststring#

This isnt tested; so no warranties Wink

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email

cf-newbie
06-15-2007 @ 5:10 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 23
Joined: May 2007

Great thanks!


Website Designed and Developed by Pablo Varando.