Skip to content
New issue

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

Does ^ work to match beginning of text? #41

Open
adisazhar123 opened this issue Feb 9, 2025 · 0 comments
Open

Does ^ work to match beginning of text? #41

adisazhar123 opened this issue Feb 9, 2025 · 0 comments

Comments

@adisazhar123
Copy link

Running a simple example with the code below fails,

lexer.Add([]byte(`^abc`), printSomething)

where printSomething is a function that prints the matched token.

Error message

got err in Scanner Regex parse error in production 'group' : at index 0 line 0 column 1 '^abc' : expected '(' at 0 got '^' of '^abc'
Regex parse error in production 'charClass' : at index 0 line 0 column 1 '^abc' : expected '[' at 0 got '^' of '^abc'
Regex parse error in production 'CHAR' : at index 0 line 0 column 1 '^abc' : unexpected operator, ^
Regex parse error in production 'char' : at index 0 line 0 column 1 '^abc' : Expected a CHAR or charRange at 0, ^abc
Regex parse error in production 'atomic' : at index 0 line 0 column 1 '^abc' : Expected group or char
Regex parse error in production 'Parse' : at index 0 line 0 column 1 '^abc' : unconsumed input

My question is, is the use of ^ to anchor the beginning of a text not supported? Are there any alternatives?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant