Skip to content

RegExp has no convenient way to see if a substring starts with a match to RegExp #166

Closed
@rakudrama

Description

@rakudrama

RegExp re = ...

I want to say something like
Match m = re.matchAt(str, pos);
or
String s = re.matchStringAt(str, pos);

The match should be tethered to the given position, i.e. succeed only if str[pos ... end) matches the re.

Currently all the RegExp methods do a search and none do a simple match. It is inconvenient to have to specify regexps with a leading ^ and there is no convenient way to convert a RegExp without a leading ^ into one with.

None of search methods allow a search in a substring. This would be OK if string.substring was guaranteed constant time + space, but the documentation on String.substring makes no claims.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions