#\br/([^_]\w+)\b#checks that it starts with anything except
_. That includes whitespace and other things you wouldn't want in the username. Since this is just a test, it's better to use a lookahead assertion, i.e.
Also, if I read correctly, usernames can use dashes so the regexp should probably be different. And you should definitely give names to the captures otherwise default ones will be chosen for you behind the scenes. The PHP line should be something like that:
Code: Select all