public Matcher matcher (CharSequence input) { return new Matcher(this, input); } }
public Matcher matcher (CharSequence input) { return new Matcher(this, input); } }
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
Persister serializer = new Persister(new Matcher() { public Transform match(Class type) throws Exception { if (type.isEnum()) { return new MyEnumTransform(type); } return null; } });
result = search( aList, new Matcher(){ public boolean matches( Some some ) { if( some.name().equals("a")) { return true; } }});
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
public Matcher matcher(CharSequence input) { if (!compiled) { synchronized(this) { if (!compiled) compile(); } } Matcher m = new Matcher(this, input); return m; }
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
/** * Returns a {@link Matcher} for this pattern applied to the given {@code input}. * The {@code Matcher} can be used to match the {@code Pattern} against the * whole input, find occurrences of the {@code Pattern} in the input, or * replace parts of the input. */ public Matcher matcher(CharSequence input) { return new Matcher(this, input); }
String name = "Mike"; // This is an English name String nameRegEx ="[A-Z][a-z]+"; //this patterns matches an english name Matcher nameMatcher = new Matcher(regEx); if (match.matches(name)){// I use the matches() method to verify the format of the string Name nameObject = Converter.getNameObjectFromString(name);//I make the conversion }
/** * Creates a matcher that will match the given input against this pattern. */ public Matcher matcher(CharSequence input) { pattern= pattern.replace("*+", "+"); return new Matcher(this, input); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }
/** * Tests whether the given {@code regularExpression} matches the given {@code input}. * Equivalent to {@code Pattern.compile(regularExpression).matcher(input).matches()}. * If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @see Pattern#compile(java.lang.String, int) * @see Matcher#matches() */ public static boolean matches(String regularExpression, CharSequence input) { return new Matcher(new Pattern(regularExpression, 0), input).matches(); }