Will img src content regex

Category: Web Develop
 
gudujiankuaile
2012-07-05 08:58:53

Sponsored Links
Help a src regex

src = ""
src = ''
src = "''"

before, only match src = "", the other is not supported
private static final String SRC_TAG = "src = \"? (. *?) (\ "|> | \ \ s +)";
private static final Pattern PATTERN_FOR_SRCTAG = Pattern.compile (SRC_TAG , Pattern.CASE_INSENSITIVE);

no robustness

hope that everyone will help

Sponsored Links

qiang987654321
2012-07-05 09:03:52
If you just listed above of these three cases, try

String pattern = "(?i)src=(['\"])((?!\\1).)*\\1";
zhouqiang923
2012-07-05 09:07:37
private static final String SRC_TAG = "src = (\" | ')? (. *?) (\ "' | \" | '|> | \ \ s +) ";

this do not know what went wrong to write a
lieshenhan
2012-07-05 09:24:29
Why not?
private static final String SRC_TAG = "src \ \ s * = \ \ s * [\ "\ ']? [\" \']? (. *?) (\ '| \ "| \' \" |> | \ \ s +) ";

This can, but end with a space
private static final String SRC_TAG = "src \ \ s * = \ \ s * [\" \ ']? [\ " \ ']? (. *?) (\' | \ "| \ '\" |>) ";

Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.