Regex to allow alphanumeric and dot

php, regex

Solution

Try using a character class (`[…]`), like this:

[\w.]+

For example:

->assert('hash','[\w.]+')

Problem

Hi I have a variable in a Silex route and we only allow alphanumeric values ``` ->assert('hash','\w+') ``` I would like to also allow a dot in the variable, but my efforts at editing this regex have failed. Help greatly appreciated, thanks!

Original source