Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/AdblockPlus.java

Issue 6298415575072768: Issue 24 - Regex: Replace Matcher.matches(...) with Matcher.find(...) (Closed)
Patch Set: Created June 2, 2014, 9:17 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/AdblockPlus.java
diff --git a/src/org/adblockplus/android/AdblockPlus.java b/src/org/adblockplus/android/AdblockPlus.java
index b77b972713b59e17acaf55ab826333422c28040f..e3c389121ffa80e316df0739f2410945bfb97a69 100755
--- a/src/org/adblockplus/android/AdblockPlus.java
+++ b/src/org/adblockplus/android/AdblockPlus.java
@@ -58,11 +58,11 @@ public class AdblockPlus extends Application
{
private static final String TAG = Utils.getTag(AdblockPlus.class);
- private static final Pattern RE_JS = Pattern.compile(".*\\.js$", Pattern.CASE_INSENSITIVE);
- private static final Pattern RE_CSS = Pattern.compile(".*\\.css$", Pattern.CASE_INSENSITIVE);
- private static final Pattern RE_IMAGE = Pattern.compile(".*\\.(?:gif|png|jpe?g|bmp|ico)$", Pattern.CASE_INSENSITIVE);
- private static final Pattern RE_FONT = Pattern.compile(".*\\.(?:ttf|woff)$", Pattern.CASE_INSENSITIVE);
- private static final Pattern RE_HTML = Pattern.compile(".*\\.html?$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern RE_JS = Pattern.compile("\\.js$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern RE_CSS = Pattern.compile("\\.css$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern RE_IMAGE = Pattern.compile("\\.(?:gif|png|jpe?g|bmp|ico)$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern RE_FONT = Pattern.compile("\\.(?:ttf|woff)$", Pattern.CASE_INSENSITIVE);
+ private static final Pattern RE_HTML = Pattern.compile("\\.html?$", Pattern.CASE_INSENSITIVE);
/**
* Update notification id.
@@ -378,15 +378,15 @@ public class AdblockPlus extends Application
if (contentType == null)
{
- if (RE_JS.matcher(url).matches())
+ if (RE_JS.matcher(url).find())
contentType = "SCRIPT";
- else if (RE_CSS.matcher(url).matches())
+ else if (RE_CSS.matcher(url).find())
contentType = "STYLESHEET";
- else if (RE_IMAGE.matcher(url).matches())
+ else if (RE_IMAGE.matcher(url).find())
contentType = "IMAGE";
- else if (RE_FONT.matcher(url).matches())
+ else if (RE_FONT.matcher(url).find())
contentType = "FONT";
- else if (RE_HTML.matcher(url).matches())
+ else if (RE_HTML.matcher(url).find())
contentType = "SUBDOCUMENT";
}
if (contentType == null)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld