Hyphen and underscore not compatible in sed

前端 未结 4 2099
傲寒
傲寒 2021-01-18 15:39

I\'m having trouble getting sed to recognize both hyphen and underscore in its pattern string.

Does anyone know why

[a-z|A-Z|0-9|\\-|_]
4条回答
  •  没有蜡笔的小新
    2021-01-18 15:58

    You don't need to use | symbol in a regex character class to separate the characters. Perhaps try something like this ...

    [a-zA-Z0-9\-_]
    

提交回复
热议问题