Reputation: 3213
I have a string in Java not escaped which contains CSS, JavaScript and HTML.
I need to extract all the CSS from this string, so basically I need to search for everything that start for <style
and finish for </style>
and everything that start for <link
and finish for >
Any suggestions?
Upvotes: 0
Views: 993
Reputation: 18750
The regex might look something like this.
String result = searchText.replaceAll("<style>([^<]*)</style>", "$1");
this should change the text to whats inside the tag, just modify it slightly for the tag
Upvotes: 2