Reputation: 21
What should I add to my regex?
^[a-zA-Z]+$
Upvotes: 0
Views: 219
Reputation: 522741
I would phrase your regex as:
^(?!.*[.,]{2})[A-Za-zñÑ.,]+$
Explanation:
^
from the start of the string(?!.*[.,]{2})
assert that no consecutive dots or commas occur[A-Za-zñÑ.,]+
match a letter, including ñ and Ñ, dot or comma, one or more times$
end of the stringUpvotes: 1