regular expression: put $ in [ ]

前端 未结 3 1502
粉色の甜心
粉色の甜心 2021-01-22 08:22
echo \"tests\"|perl -pe \"s/s[t$]//g\"
Unmatched [ in regex; marked by <-- HERE in m/s[ <-- HERE 5.020000/ at -e line 1, <> line 1.

Can\'t

3条回答
  •  不知归路
    2021-01-22 09:19

    Alternatively, use sed with your expression as is:

    echo "tests"| sed "s/s[t$]//g"
    

提交回复
热议问题