You can use the following regular expression to remove the <font>
tags and their attributes while leaving the multi-line contentinside intact:
<font\b[^>]*>([\s\S]*?)<\/font\s*>
Explanation:
<font\b[^>]*>
: This part matches the opening<font>
tag along with any attributes.([\s\S]*?)
: This is a capturing group that matches any characters (including whitespace and newlines) non-greedily. It captures content that spans multiple lines.<\/font\s*>
: This part matches the closing</font>
tag, allowing for optional spaces.
This updated regular expression should work better for capturing multi-line content within the <font>
tags and removing the tags themselves. However, remember that while this can work in simple cases, for more complex HTML, using a dedicated HTML parsing library is recommended.