Skip to main content

extract

Function extract 

Source
pub fn extract<D: Dimension>(
    a: &StringArray<D>,
    pattern: &str,
) -> FerrayResult<StringArray1>
Expand description

Extract the first capture group from each string element.

For each string, finds the first match of the pattern and returns the contents of capture group 1. If there is no match or no capture group, an empty string is returned.

The pattern must contain at least one capture group (...).

ยงErrors

Returns FerrayError::InvalidValue if the regex pattern is invalid. Returns an error if the internal array construction fails.