public void split(List<RegexRule> rules) {
			// Skip when no rules are given.
			if (rules.isEmpty())
				return;

			// Match within give region
			String localText = text.substring(start, end);
			if (localText.isEmpty())
				return;

			Matcher matcher = getCombinedPattern(rules).matcher(localText);
			while (matcher.find()) {
				// Create region from found match
				int localStart = matcher.start();
				int localEnd = matcher.end();
				RegexRule matchedRule = getRuleFromMatcher(rules, matcher);
				Region localChild = new Region(text, this, matchedRule, start + localStart, start + localEnd);

				// Break the new region into smaller ones if the rule associated with the match has sub-rules.
				List<RegexRule> subrules = matchedRule.subRules();
				if (!subrules.isEmpty()) localChild.split(subrules);

				// Add child (splitting technically handled in output logic)
				children.add(localChild);
			}
		}
Splits this node into subregions based on the given rules.

@param rules
		Rules to match and split by.
recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/syntax/RegexSyntaxHighlighter.java