List of usage examples for java.util.regex Pattern CASE_INSENSITIVE
int CASE_INSENSITIVE
To view the source code for java.util.regex Pattern CASE_INSENSITIVE.
Click Source Link
From source file:com.haulmont.yarg.formatters.impl.inline.ImageContentInliner.java
public ImageContentInliner() { tagPattern = Pattern.compile(REGULAR_EXPRESSION, Pattern.CASE_INSENSITIVE); }
From source file:net.jforum.core.events.post.BadWordEvent.java
/** * @see net.jforum.events.EmptyPostEvent#beforeAdd(net.jforum.entities.Post) *///w w w .ja v a 2 s . c o m @Override public void beforeAdd(Post post) { List<BadWord> words = this.repository.getAll(); for (BadWord word : words) { Pattern pattern = Pattern.compile("\\b" + word.getWord() + "\\b", Pattern.CASE_INSENSITIVE); post.setText(this.applyFilter(post.getText(), word.getReplacement(), pattern)); if (!StringUtils.isEmpty(post.getSubject())) { post.setSubject(this.applyFilter(post.getSubject(), word.getReplacement(), pattern)); } if (!StringUtils.isEmpty(post.getTopic().getSubject())) { post.getTopic() .setSubject(this.applyFilter(post.getTopic().getSubject(), word.getReplacement(), pattern)); } } }
From source file:adalid.util.io.RegexPathFilter.java
public RegexPathFilter(String pattern) { if (pattern == null) { throw new IllegalArgumentException("pattern"); }/*from w ww . j a v a 2s. co m*/ _pattern = WINDOWS ? Pattern.compile(pattern, Pattern.CASE_INSENSITIVE) : Pattern.compile(pattern); }
From source file:com.microsoft.tfs.client.eclipse.tpignore.TPIgnoreFileParser.java
/** * Gets the flags appropriate for this platform's filesystem's * case-sensitivity./*from www.j a v a 2 s . c o m*/ */ private synchronized static int getCompileFlags() { if (compileFlags == -1000) { if (FileHelpers.doesFileSystemIgnoreCase()) { compileFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE; } else { compileFlags = 0; } } return compileFlags; }
From source file:org.salarymaster.DAO.SuggestionDAOMongo.java
@Cacheable("suggestion") public List<String> getSuggestion(String collection, String name, int limit) { String pattern = "^" + name; FindIterable<Document> iterable = db.getCollection(collection) .find(new BasicDBObject("_id", Pattern.compile(pattern, Pattern.CASE_INSENSITIVE))) .sort(new BasicDBObject("total", -1)).limit(limit); log.info("iterable: " + iterable); return iterToList(iterable); }
From source file:de.ist.clonto.webwiki.InfoboxParser.java
public List<Information> parse(String text) { String pagetext = replaceHTMLComments(text); List<Information> setlist = new ArrayList<Information>(); Pattern pattern = Pattern.compile("\\{\\{\\s*infobox", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.DOTALL); Matcher matcher = pattern.matcher(pagetext); while (matcher.find()) { int begin = matcher.start(); int bracketnr = 2; int end = begin + matcher.group().length(); while (end < pagetext.length()) { switch (pagetext.charAt(end)) { case '}': bracketnr--;// w ww. j a v a 2 s.c o m break; case '{': bracketnr++; break; } if (bracketnr == 0) { break; } end++; } String infobox = pagetext.substring(begin, end); Information info = parseSet(infobox); setlist.add(info); } return setlist; }
From source file:cherry.foundation.springmvc.CsrfRequestMatcherTest.java
@Test public void testMatches() { RequestMatcher m = new AntPathRequestMatcher("/logout/**"); CsrfRequestMatcher matcher = new CsrfRequestMatcher(); matcher.setAllowedMethods(Pattern.compile("^(GET|HEAD|TRACE|OPTIONS)$", Pattern.CASE_INSENSITIVE)); matcher.setExcludes(asList(m));/*from w w w.j ava 2s . c o m*/ assertFalse(matcher.matches(createRequest("GET", "/login"))); assertFalse(matcher.matches(createRequest("GET", "/logout"))); assertTrue(matcher.matches(createRequest("POST", "/login"))); assertFalse(matcher.matches(createRequest("POST", "/logout"))); }
From source file:com.adguard.commons.lang.Wildcard.java
/** * Initializes a wildcard with the given pattern. * * @param pattern Pattern */ public Wildcard(String pattern) { this(pattern, Pattern.CASE_INSENSITIVE); }
From source file:com.gtdfree.test.XMLTest.java
public void testRegularExpression() { try {// www . j a va2s .c om Pattern pattern = Pattern.compile("<\\?.*?encoding\\s*?=.*?\\?>", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher( "<?xml version=\"1.0\" encoding=\"UTF-8\"?><gtd-data version=\"2.1\" modified=\"2008-10-10T12:42:55.905+0200\">"); System.out.println(matcher.toString()); assertTrue(matcher.find()); pattern = Pattern.compile("<\\?.*?encoding\\s*?=.*?\\?>", Pattern.CASE_INSENSITIVE); matcher = pattern.matcher( "\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><gtd-data version=\"2.1\" modified=\"2008-10-12T23:50:46.176+0200\">"); System.out.println(matcher.toString()); assertTrue(matcher.find()); pattern = Pattern.compile("<\\?.*?encoding\\s*?=.*?\\?>", Pattern.CASE_INSENSITIVE); matcher = pattern.matcher( "\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<gtd-data version=\"2.1\" modified=\"2008-10-12T23:50:46.176+0200\">"); System.out.println(matcher.toString()); assertTrue(matcher.find()); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
From source file:br.com.blackhubos.commandteleporter.Framework.java
public static long reverseOf(final String tempo) { if (tempo == null) { return 0L; }//from w w w. ja v a2 s. c o m final Pattern verifier = Pattern.compile("(([0-9]+)(h|m|s))", Pattern.CASE_INSENSITIVE); final Matcher m = verifier.matcher(tempo.toLowerCase()); long delay = 0L; while (m.find()) { final int numero = Integer.parseInt(m.group(2)); final char c = m.group(3).charAt(0); if (c == 's') { delay += numero * 20L; } else if (c == 'm') { delay += (numero * 60) * 20L; } else if (c == 'h') { delay += ((numero * 60) * 20L) * 60; } } return delay; }