DEV Community

Samandar Ravshanov
Samandar Ravshanov

Posted on

📦Regular expression for matching HTML comments

from functorflow import f

#Regular expression for matching HTML comments

with_comment = '<!DOCTYPE html><!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body></body></html>'

no_comment = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body></body></html>'


print(f('html-comment', with_comment)) # True

print(f('html-comment', no_comment)) # False
Enter fullscreen mode Exit fullscreen mode

Top comments (0)