Skip to main content

//ERDDAP/com.cohort.util/ScriptString2/extractAllCaptureGroupsAsStringArray

extractAllCaptureGroupsAsStringArray

[JVM]
open fun extractAllCaptureGroupsAsStringArray(s: String, regex: String, captureGroupNumber: Int): Array<String>

This repeatedly finds the regex and extracts the specified captureGroup.

Return​

a String[] with the found strings in their original order.

Parameters​

JVM

sthe source String
regexthe regular expression, see java.util.regex.Pattern. Note that you often want to use the "reluctant" qualifiers which match as few chars as possible (e.g., ??, *?, +?) not the "greedy" qualifiers which match as many chars as possible (e.g., ?, *, +).