I am looking for a regular expression that can get me src (case insensitive) tag from following HTML snippets in java.
This answer is for google searchers, Because it's too late
Copying cletus's showed error and
Modifying his answer and passing modified String src\\s*=\\s*([\"'])?([^\"']*) as parameter passed into Pattern.compile worked for me,
Here is the full example
String htmlString = "
"; //Sample HTML
String ptr= "src\\s*=\\s*([\"'])?([^\"']*)";
Pattern p = Pattern.compile(ptr);
Matcher m = p.matcher(htmlString);
if (m.find()) {
String src = m.group(2); //Result
}