I am looking for a regular expression that can get me src (case insensitive) tag from following HTML snippets in java.
One possibility:
String imgRegex = "
]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";
is a possibility (if matched case-insensitively). It's a bit of a mess, and deliberately ignores the case where quotes aren't used. To represent it without worrying about string escapes:
]+src\s*=\s*['"]([^'"]+)['"][^>]*>
This matches:
![]()
> (i.e. possible other attributes)src=' or "> (more possible attributes)> to close the tagThings to note:
src= as well, move the open bracket further left :-)> or image sources that include ' or ").