Regex testing?

I’m trying to see if this regex works for allowing only alphanumeric, @, ^, and & characters

$pattern = '/^[a-zA-Z0-9\^\$\@]{5}$/';

Is that right?

It seems you meant $ instead of &?

Apart from that, it looks right. You can always paste it in https://regex101.com/ and run tests there (sometimes that is easier than running your app)

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.