I have problem with regex on Java, right now.
I have string like:
img border=\"0\" src=\"http://www.stackoverflow.com http://nbsp;https://<
and wanna make a regex that find only two "http://" excepting "src=\"http://" to replace the "http://" to something else.
String input = "border=\"0\" src=\"http://www.stackoverflow.com http://";
String regexStr = "(?!src=\"http://).*$";
Pattern pattern = Pattern.compile(regexStr);
Matcher matcher = pattern.matcher(input);
if (matcher.matches())
System.out.println("String " + input + " has the word src=\"http:// in it ");
else
System.out.println("String " + input + " hasn't the word src=\"http:// in it ");
I'm searching related with this, but didn't find perfect answer yet.
Any comment would be appreciated. Thanks.