Stack Overflow archive
7 score

Remove style tag from a text file with regex

score
7
question views
13.7K
license
CC BY-SA 3.0

Tested on regex101.

Pattern:

xml
<style((.|\n|\r)*?)<\/style>    

Your code:

java
String text = readFile("E:/textwithstyletags.txt");
retVal = text.replaceAll("<style((.|\\n|\\r)*?)<\\/style>", "");

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.