Artificial intelligent assistant

awk (mawk): regular expression compile failed (missing operand) I want to use the following regex with awk to validate phone numbers: echo 012-3456-7890 | awk '/^\(?0[1-9]{2}\)?(| |-|.)[1-9][0-9]{3}( |-|.)[0-9]{4}$/ {print $0}' But I am getting the following error: awk: line 1: regular expression compile failed (missing operand)

Since the ranges used here are of fixed length, you could simply write out the entire range `[0-9]{3}` => `[0-9][0-9][0-9]`. And instead of `(| |-|.)`, `( |-|.)?` \- though I am confused: are you allowing any character (`.`), in addition to space and `-`? Then it could just be `.?` since space and `-` are matched by `.` anyway. If you're matching the literal period `.`, then you should use `[- .]?` instead (the leading `-` is to avoid interpretation as a character range). So:


^\(?0[1-9]{2}\)?(| |-|.)[1-9][0-9]{3}( |-|.)[0-9]{4}$


Becomes:


^\(?0[1-9][1-9]\)?[- .]?[1-9][0-9][0-9][0-9][- .][0-9][0-9][0-9][0-9]$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f0ec900f83ff56fbb293c8e44a8ac94d