Regex validation with WTForms and python
Replacing the regex with
'^\w+$'
solved the problem.
I know this was answered a long time ago, but another option I discovered to provide alphanumeric validation on WTForms is AlphaNumeric()
from wtforms_validators import AlphaNumeric
...
class SignupForm(Form):
login_id = StringField('login Id', [DataRequired(), AlphaNumeric()])
More details here https://pypi.org/project/wtforms-validators/