0
  1. Alphabets allowed
  2. Number and Special characters are not allowed
  3. If you enter number one alphabet should be enter

https://www.regextester.com/

(^[a-zA-Z ]*)?(^[0-9 ]+[ a-zA-Z])*$

this expression is working only problem with when i type 123 main street it only allow 123 m i wanted to make it infinite

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
user1137387
  • 1,933
  • 3
  • 18
  • 27

1 Answers1

0

Add + quantifier after your last class as the following suggests:

(^[a-zA-Z ]*)?(^[0-9 ]+[ a-zA-Z]+)*$

You should refrain from using regex to parse addresses though, it will break. See this post for more information

ctwheels
  • 21,901
  • 9
  • 42
  • 77