Divide the regex into two separate parts:
Regex will be:
^((?:\+33\s|0)[1-9](?:\s\d{2}){4})$ ^ non-capturing group for prefix ^ non-capturing group for number ( ) ^ actual capture group from your original regex
This allows you to use a space as a separator; if you need something more open, Thomas Ayoub answer is more detailed.
tested in Regex101
Note: According to Thomas's comment, since the regular expression is a complete match using the start and end tokens ( ^$ ), the capture group is redundant. Then you can output it like this:
^(?:\+33\s|0)[1-9](?:\s\d{2}){4}$
and it should work fine.
R nar source share