private static List<String> parseSection(final String name, final String source) { // >>> return [s.strip() for s in pattern.findall(source)] { final List<String> u = Re.findAll("^([^\\n]*" + name + "[^\\n]*\\n?(?:[ \\t].*?(?:\\n|$))*)", source, Re.IGNORECASE | Re.MULTILINE); for (int i = 0; i < u.size(); i++) { u.set(i, u.get(i).trim()); } return u; } }
public static List<String> split(final String pattern, final String string) { if (!hasGrouping(pattern)) { return list(string.split(pattern)); } final Matcher matcher = Pattern.compile(pattern, 0).matcher(string); final List<String> matches = list(); int start = 0; while (matcher.find()) { matches.add(string.substring(start, matcher.start())); for (int i = 0; i < matcher.groupCount(); i++) { matches.add(matcher.group(i + 1)); } start = matcher.end(); } matches.add(string.substring(start)); return matches; }
final List<String> matched = Re.findAll("\\[default: (.*)\\]", description, Re.IGNORECASE); value = bool(matched) ? matched.get(0) : null;
split = Re.split("\\n *(-\\S+?)", "\n" + s); split.remove(0);
split = Re.split("\\n *(-\\S+?)", "\n" + s); split.remove(0);
final List<String> matched = Re.findAll("\\[default: (.*)\\]", description, Re.IGNORECASE); value = bool(matched) ? matched.get(0) : null;
public static List<String> split(final String pattern, final String string) { if (!hasGrouping(pattern)) { return list(string.split(pattern)); } final Matcher matcher = Pattern.compile(pattern, 0).matcher(string); final List<String> matches = list(); int start = 0; while (matcher.find()) { matches.add(string.substring(start, matcher.start())); for (int i = 0; i < matcher.groupCount(); i++) { matches.add(matcher.group(i + 1)); } start = matcher.end(); } matches.add(string.substring(start)); return matches; }
public static List<String> findAll(final String pattern, final String string, final int flags) { return findAll(Pattern.compile(pattern, flags), string); }
public static List<String> findAll(final String pattern, final String string, final int flags) { return findAll(Pattern.compile(pattern, flags), string); }
public static Tokens fromPattern(String source) { source = Re.sub("([\\[\\]\\(\\)\\|]|\\.\\.\\.)", " $1 ", source); List<String> $source; // >>> source = [s for s in re.split('\s+|(\S*<.*?>)', source) if s] { $source = list(); for (final String s : Re.split("\\s+|(\\S*<.*?>)", source)) { if (bool(s)) { $source.add(s); } } } return Tokens.withLanguageError($source); }
private static List<String> parseSection(final String name, final String source) { // >>> return [s.strip() for s in pattern.findall(source)] { final List<String> u = Re.findAll("^([^\\n]*" + name + "[^\\n]*\\n?(?:[ \\t].*?(?:\\n|$))*)", source, Re.IGNORECASE | Re.MULTILINE); for (int i = 0; i < u.size(); i++) { u.set(i, u.get(i).trim()); } return u; } }
public static Tokens fromPattern(String source) { source = Re.sub("([\\[\\]\\(\\)\\|]|\\.\\.\\.)", " $1 ", source); List<String> $source; // >>> source = [s for s in re.split('\s+|(\S*<.*?>)', source) if s] { $source = list(); for (final String s : Re.split("\\s+|(\\S*<.*?>)", source)) { if (bool(s)) { $source.add(s); } } } return Tokens.withLanguageError($source); }