User-submitted Java Projects

59
2770 reads

March 6, 2013

Use split().


Strings in Java have build in support for regular expressions. Strings have three build in methods for regular expressions, e.g. matches(), split()), replace().

331
4870 reads

March 6, 2013

Use replaceAll()


replaceAll("regex", "replacement") replaces all regex matches inside the string with the replacement string you specified.

136
3125 reads

March 6, 2013

Use a Character Class


With a "character class", also called "character set", you can tell the regex engine to match only one out of several characters.

236
4685 reads

March 6, 2013

Use the ? quantifier.


Quantifiers allow you to specify the number of occurrences to match against.

? quantifier means it Occurs no or one times, ? is short for {0,1}
Example: X? -Finds no or exactly one letter X

95
2532 reads

March 6, 2013

Use Wildcard and Quantifier.


Quantifiers allow you to specify the number of occurrences to match against.

373
5137 reads

March 6, 2013

Use a quantifier.


Quantifiers allow you to specify the number of occurrences to match against.

156
3034 reads

March 6, 2013

Use find() to Find Multiple Subsequences


For advanced regular expressions the java.util.regex.Pattern and java.util.regex.Matcher classes are used.

89
2788 reads

March 6, 2013

Use find() to Find a Subsequence


For advanced regular expressions the java.util.regex.Pattern and java.util.regex.Matcher classes are used.

213
3985 reads

March 6, 2013

Simple Pattern Matching Demo


A regular expression defines a search pattern for strings. Regular expressions can be used to search, edit and manipulate text.

The abbreviation for regular expression is regex.