Code example for Matcher

Methods: find, group

0
 
	private java.util.regex.Pattern mPattern = java.util.regex.Pattern.compile("^(.*)\\s*\\((.*)\\)\\s*$");
 
	public Series(String name) {
		java.util.regex.Matcher m = mPattern.matcher(name);
		if (m.find()) {
			this.name = m.group(1).trim();
			this.num = cleanupSeriesPosition(m.group(2));
		} else { 
			this.name = name.trim();
			this.num = "";
		} 
		this.id = 0L;
	} 
 
	Series(long id, String name) {
		this(id, name, "");
	} 
 
	public Series(String name, String num) {
		this(0L, name, num);