Skip to content

chore: (minor) extending the Evaluator regex#289

Merged
ramedina86 merged 7 commits intowriter:devfrom
mmikita95:chore-evaluator-regexp-enhancement
Apr 23, 2024
Merged

chore: (minor) extending the Evaluator regex#289
ramedina86 merged 7 commits intowriter:devfrom
mmikita95:chore-evaluator-regexp-enhancement

Conversation

@mmikita95
Copy link
Contributor

Adding a dash to this regular expression enables support for "skewer-case" state property names on frontend side.

"""

template_regex = re.compile(r"[\\]?@{([\w\s.\[\]]*)}")
template_regex = re.compile(r"[\\]?@{([\w\s.\[\]]*)}", re.U)
Copy link
Contributor Author

@mmikita95 mmikita95 Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I eventually found out, this flag is redundant and included for backward compatibility. Won't be added as per latest commit.

"""

template_regex = re.compile(r"[\\]?@{([\w\s.\[\]]*)}")
template_regex = re.compile(r"[\\]?@{([^{]*)}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r"[\\]?@{([^{]*)}"

[\\]: matches a single character present in the list (\\ matches the character \ literally)
@{: matches the characters @{ literally
Capturing Group ([^{]*): matches a single character not present in the list (excludes {)
*: matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
}: matches the character } literally

@mmikita95 mmikita95 changed the title chore: (minor) adding dash to template_regex in Evaluator class chore: (minor) extending the Evaluator regex Apr 23, 2024
@ramedina86 ramedina86 merged commit a92d836 into writer:dev Apr 23, 2024
@mmikita95 mmikita95 deleted the chore-evaluator-regexp-enhancement branch April 23, 2024 13:48
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

Successfully merging this pull request may close these issues.

2 participants