Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
Java
|
Regular expressions
References
Example: Groups
References
See this page for more details java regular expressions:
http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
Example: Groups
final Pattern pattern = Pattern.compile("^([a-zA-Z]+)? (\\w+)$"); final Matcher matcher = pattern.matcher("ABC _012_"); if (matcher.matches()) { final String group1 = matcher.group(1); final String group2 = matcher.group(2); System.out.println(group1); System.out.println(group2); }
© 2010-2022
mti
tek