Jump to content
Sign in to follow this  

RegEXP not working

Recommended Posts


Hi folks,

I've got a big string with many HTML comments. I wish to strip them all out. An example snippet:

<font face=
"times new roman,times"><!--[if
!supportFootnotes]--><span class=
"MsoFootnoteReference"><span style=
"font-size: 12pt;

My code:

$fileHTML = StringRegExpReplace($fileHTML, "<!--(.*?)-->", "")

Unfortunately, this has no effect at all on the above code. Am I doing something wrong?

Share this post

Link to post
Share on other sites

$fileHTML = StringRegExpReplace($fileHTML, "(?s)<!--(.*?)-->", "")

That fixed it!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.