Skip to content

Add method to get full match from Captures #1146

@tmccombs

Description

@tmccombs

Describe your feature request

Add a method to regex::Captures that is equvalent to (or even just this implementation):

#[inline]
fn full_match(&self) -> Match<'h'> {
    self.get(0).unwrap()
}

Getting the full match is a very common operation, and although the documetation for Regex::get says that getting the result at index 0 will always return Some, that property isn't reflected in the type system. And adding a method like this would expose that guarantee through the type of the public API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions