We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is your question?
Facing an issue with a pipe in terminal regex.
Here is a subset of the grammar in question:
from lark import Lark grammar = """ start: START START: QUARTER [WS+ YEAR] QUARTER: /q[1-4]/ WS: /\s/ YEAR: /(19[0-9]{2})|(20[0-3][0-9])/ """ print(Lark(grammar).parse("q1 1923")) # works print(Lark(grammar).parse("q1 2023")) # doesn't work
However, when we add parenthesis around the full YEAR regex, both the string examples get parsed correctly.
YEAR
This works:
from lark import Lark grammar = """ start: START START: QUARTER [WS+ YEAR] QUARTER: /q[1-4]/ WS: /\s/ YEAR: /((19[0-9]{2})|(20[0-3][0-9]))/ """ print(Lark(grammar).parse("q1 1923")) # works print(Lark(grammar).parse("q1 2023")) # works now
What am I missing here?
The text was updated successfully, but these errors were encountered:
Fix issue lark-parser#1414 by correctly putting patterns into non-cap…
501eb77
…turing groups
This is a bug in the way lark combines terminals, #1415 fixes it.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
What is your question?
Facing an issue with a pipe in terminal regex.
Here is a subset of the grammar in question:
However, when we add parenthesis around the full
YEAR
regex, both the string examples get parsed correctly.This works:
What am I missing here?
The text was updated successfully, but these errors were encountered: