Jason94
Jason94

Reputation: 13610

regex, how to allow spaces

Here it is:

'/^\b[a-z]{0,20}$/i'

I'm trying to match work positions:

"Employee", "Daily Manager"++.

I need to allow A-Za-z + spaces and lenght from 0-20

Any help?

Upvotes: 0

Views: 85

Answers (3)

Jakob Alexander Eichler
Jakob Alexander Eichler

Reputation: 3056

[\w ]{0,20}

Furthermore \s covers all white spaces.

Upvotes: 0

Nick Weaver
Nick Weaver

Reputation: 47241

What about

'/^\b[a-z ]{0,20}$/i'

Upvotes: 5

Emmerman
Emmerman

Reputation: 2343

'/^\b[a-z ]{0,20}$/i' simple

Upvotes: 2

Related Questions