Skip to content

difficulty parsing any amount of text between 2 tokens #21

@camergardi

Description

@camergardi

I'm trying to make a parser that will parse

[IGNORE]
comment
random stuff
[END]

with something like

    ignoreHeaderStart = "[IGNORE]"
    ignoreHeaderEnd = "[END]"
    matchAnyThing = REGEXP(".*") 
    ignoreSection = Sequence(ignoreHeaderStart, matchAnyThing, ignoreHeaderEnd)

but the only way I have been able to do it is by using a complicated regex because matchAnything is too greedy and consumes the last [END]. So the parser is always waiting for an [END] token.

is there a way to parse anything from a starting token to an end token that allows anything in the middle?

i'm not asking for a regex that will do what I want, I've found one but it is not very practical(i'm interested in other ones that would work just out of interest), but I think a built in pyleri function would be more suitable for the job

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions