I have a big regex for a name field that looks like this.
^(?:(?!(?:.*[ ]){2})(?!(?:.*[']){2})(?!(?:.*[-]){2})(?:[a-zA-Z0-9 \p{L}'-]{3,48}$))$
I'm not a regex expert, I got this so far with Stackoverflow and RegexBuddy. But there is one line that I come across. The first positive result, (?!(?:.*[ ]){2})this prevents the presence of several spaces.
This is not quite what I want. I just want to make sure there cannot be several spaces in the sequence . Like double spaces and the like. This regex prevents more than 1 space in the entire line.
I'm trying to figure out how to change this, but I'm really at a dead end. Is there a way to enforce this concept with the rest of the regular expression?
C # where this will be done.
Ciel source
share