Μετάβαση στο κύριο περιεχόμενο

//ERDDAP/com.cohort.util/ScriptString2/extractCaptureGroup

extractCaptureGroup

[JVM]
open fun extractCaptureGroup(s: String, regex: String, captureGroupNumber: Int): String

This returns the specified capture group from s.

Return

the value of the specified capture group in the first match of the regex, or null if the s doesn't match the regex

Parameters

JVM

sthe source String
regexthe regular expression, see java.util.regex.Pattern, which matches part of s.
captureGroupNumberthe number of the capture group (0 for entire regex, 1 for first capture group, 2 for second, etc.)

Throws

RuntimeExceptionif trouble, e.g., invalid regex syntax