panphp / pan

A simple, lightweight, and privacy-focused product analytics php package
MIT License
1.08k stars 48 forks source link

Replace `regex` rule with `alpha_dash:ascii` #28

Closed austincarpenter closed 3 weeks ago

austincarpenter commented 3 weeks ago

This PR replaces the event name regex validation from:

/^[A-Za-z0-9-_]+$/

to Laravel's alpha_dash:ascii which is:

/\A[a-zA-Z0-9_-]+\z/u

Whilst the outcome is essentially the same, the latter rule is superior as it matches the absolute start/end of the string and enforces Unicode pattern matching.

I've also added a test case for this rule.