shell中的正则匹配
在shell中的正则匹配不能用 _
具体案例:
station_domain regexp '[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?'
报错
Error: Error while compiling statement: FAILED: PatternSyntaxException Illegal character range near index 3
[w-_]+(.[w-_]+)+([w-.,@?^=%&:/~+#]*[w-@?^=%&/~+#])?
^ (state=42000,code=40000)
更改为以下正则后,成功运行
station_domain regexp '[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:[0-9]{1,5})?$';"