How do you “debug” a regular expression with sed?

后端 未结 8 1660
日久生厌
日久生厌 2021-01-31 08:19

I\'m trying to use a regexp using sed. I\'ve tested my regex with kiki, a gnome application to test regexpd, and it works in kiki.

date: 2010-10-29          


        
8条回答
  •  耶瑟儿~
    2021-01-31 09:05

    You have to use the -r flag for extended regex:

    sed -r 's/author:\s[0-9]{11};//g'
    

    or you have to escape the {} characters:

    sed 's/author:\s[0-9]\{11\};//g'
    

提交回复
热议问题