Hello Developer, I am writing this email regarding an issue with the command “egrep”, I wrote the following script and try to get a user to enter their postal code in the correct format, otherwise, it will not pass.
Please see picture1 As you can see, the format should be [[:upper:]][[:digit:]][[:upper:]][[:space:]][[:digit:]][[:upper:]][[:digit:]] I want to give the user an error if they enter more than one space, but it did not work. Please see picture2 Still exit the while loop even if the user enters more than 1 space I have tried the following, and it did not work as I expected: '^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$' '^[A-Z][0-9][A-Z]\s[0-9][A-Z][0-9]$' '^[A-Z][0-9][A-Z][[:space:]][0-9][A-Z][0-9]$' '^[A-Z][0-9][A-Z][[:space:]]{1}[0-9][A-Z][0-9]$' I have tried to google many cases and looks like quite a bit of people having issues limiting the number of spaces that they want, so I am wondering if it is a bug. What would be the correct way to limit users entering 1 space only? I really appreciate your time to address this issue, hope you have a wonderful day. Wilson.