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.sap.prd.mobile.ios.mios.XCodeVersionUtil.java
public static String getBuildVersion(String xCodeVersionString) throws XCodeException { Pattern buildPattern = Pattern.compile("Build version (\\w+)", Pattern.CASE_INSENSITIVE); Matcher buildMatcher = buildPattern.matcher(xCodeVersionString); if (buildMatcher.find()) { return buildMatcher.group(1); }/*from w ww . java2 s .co m*/ throw new XCodeException("Could not get xcodebuild build version"); }
From source file:com.github.koraktor.steamcondenser.community.SteamGame.java
/** * Checks if a game is up-to-date by reading information from a * <code>steam.inf</code> file and comparing it using the Web API * * @param path The file system path of the `steam.inf` file * @return <code>true</code> if the game is up-to-date * @throws IOException if the steam.inf cannot be read * @throws JSONException if the JSON data is malformed * @throws SteamCondenserException if the given steam.inf is invalid or * the Web API request fails/*from w w w. j av a 2 s. c om*/ */ public static boolean checkSteamInf(String path) throws IOException, JSONException, SteamCondenserException { BufferedReader steamInf = new BufferedReader(new FileReader(path)); String steamInfContents = ""; while (steamInf.ready()) { steamInfContents += steamInf.readLine() + "\n"; } steamInf.close(); Pattern appIdPattern = Pattern.compile("^\\s*appID=(\\d+)\\s*$", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); Matcher appIdMatcher = appIdPattern.matcher(steamInfContents); Pattern versionPattern = Pattern.compile("^\\s*PatchVersion=([\\d\\.]+)\\s*$", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); Matcher versionMatcher = versionPattern.matcher(steamInfContents); if (!(appIdMatcher.find() && versionMatcher.find())) { throw new SteamCondenserException("The steam.inf file at \"" + path + "\" is invalid."); } int appId = Integer.parseInt(appIdMatcher.group(1)); int version = Integer.parseInt(versionMatcher.group(1).replace(".", "")); return isUpToDate(appId, version); }
From source file:com.betfair.tornjak.monitor.overlay.RegExpMatcher.java
private Pattern createPattern(String regEx) { if (StringUtils.isNotBlank(regEx)) { return Pattern.compile(regEx, Pattern.CASE_INSENSITIVE); }// w ww .j av a 2 s.com return null; }
From source file:de.tbuchloh.kiskis.gui.SearchWorker.java
/** * @param keyword/*from w w w . jav a 2 s . c om*/ * is the keyword to search * @return a new regex. */ public static Pattern createKeywordQuery(final String keyword) { return Pattern.compile("[\\p{ASCII}]*" + keyword + "[\\p{ASCII}]*", //$NON-NLS-1$ //$NON-NLS-2$ Pattern.CASE_INSENSITIVE); }
From source file:net.longfalcon.newsj.service.RegexService.java
public void checkRegexesUptoDate(String latestRegexUrl, int latestRegexRevision) { RestTemplate restTemplate = new RestTemplate(); String responseString = restTemplate.getForObject(latestRegexUrl, String.class); Pattern pattern = Pattern.compile("\\/\\*\\$Rev: (\\d{3,4})", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(responseString); if (matcher.find()) { int revision = Integer.parseInt(matcher.group(1)); if (revision > latestRegexRevision) { _log.info(//from www . j a v a2s .c om "URL " + latestRegexUrl + " reports new regexes. Run the following SQL at your own risk:"); _log.info(responseString); } } }
From source file:com.ibm.watson.catalyst.corpus.tfidf.Template.java
public static Pattern getTemplatePattern(File file, String before, String after) { StringBuffer sb = new StringBuffer(); List<String> verbs = new ArrayList<String>(); try (BufferedReader br = new BufferedReader(new FileReader(file))) { while (br.ready()) verbs.add(br.readLine());/*ww w . j a v a 2 s . c o m*/ } catch (FileNotFoundException e) { throw new IllegalStateException("Could not find " + file.toString()); } catch (IOException e) { throw new IllegalStateException("IO Error reading " + file.toString()); } sb.append(before).append(makeOr(verbs)).append(after); Pattern p = Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE); return p; }
From source file:at.gv.egovernment.moa.id.protocols.oauth20.OAuth20Util.java
public static boolean isUrl(final String url) { Pattern urlPattern;//from www .j a v a2 s . co m if (url.startsWith("file")) { urlPattern = Pattern.compile(REGEX_FILE, Pattern.CASE_INSENSITIVE); } else { urlPattern = Pattern.compile(REGEX_HTTPS, Pattern.CASE_INSENSITIVE); } Matcher matcher = urlPattern.matcher(url); return matcher.find(); }
From source file:com.shahnami.fetch.Controller.FetchMusic.java
public boolean isYTLink(String query) { String pattern = "https?:\\/\\/(?:[0-9A-Z-]+\\.)?(?:youtu\\.be\\/|youtube\\.com\\S*[^\\w\\-\\s])([\\w\\-]{11})(?=[^\\w\\-]|$)(?![?=&+%\\w]*(?:['\"][^<>]*>|<\\/a>))[?=&+%\\w]*"; Pattern compiledPattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); Matcher matcher = compiledPattern.matcher(query); while (matcher.matches()) { System.out.println(matcher.group()); return true; }/*from w w w .j a va 2 s . c om*/ return false; }
From source file:com.streamreduce.core.dao.UserDAO.java
public User findUser(String username) { Assert.hasText(username);//from w ww.ja va 2 s. c om return ds.createQuery(entityClazz).field("username") .equal(Pattern.compile("^\\Q" + username + "\\E$", Pattern.CASE_INSENSITIVE)).get(); }
From source file:com.nuxeo.intranet.jenkins.web.JenkinsJobsActions.java
/** * Converts a job comment to HTML and parses JIRA issues to turn them into * links./*from ww w .j av a2s.c om*/ * * @param jiraUrl TODO */ public String getConvertedJobComment(String toConvert, String jiraURL, String[] jiraProjects) { if (toConvert == null) { return null; } if (StringUtils.isBlank(jiraURL) || jiraProjects == null || jiraProjects.length == 0) { toConvert = toConvert.replace("\n", "<br />\n"); return toConvert; } String res = ""; String regexp = "\\b(" + StringUtils.join(jiraProjects, "|") + ")-\\d+\\b"; Pattern pattern = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE); Matcher m = pattern.matcher(toConvert); int lastIndex = 0; boolean done = false; while (m.find()) { String jiraIssue = m.group(0); res += toConvert.substring(lastIndex, m.start()) + getJiraUrlTag(jiraURL, jiraIssue); lastIndex = m.end(); done = true; } if (done) { res += toConvert.substring(lastIndex); } else { res = toConvert; } res = res.replace("\n", "<br />\n"); return res; }