Skip to content

Handling of square brackets inside classes in regexes is broken #67

@metthal

Description

@metthal

When you have regexp like /[[]*+]/ it handles it somehow weirdly and you end up with an error

yaramod.ParserError: Error at 8.28: Syntax error: Unexpected regexp +, expected one of (, ), /, regexp |, regexp ?, regexp ^, regexp $, regexp ., regexp ., regexp \w, regexp \W, regexp \s, regexp \S, regexp \d, regexp \D, regexp \b, regex
p \B, regexp class

If you remove the first ] from the regexp (so /[[*+]/``) it works. The square brackets inside classes are handled somehow weirdly. Even if you escape them ]`. We don't have to build such a resistant parser that it will handle them when they are not escaped but I would expect that it doesn't fail when they are escaped.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions