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

后端 未结 8 1582
日久生厌
日久生厌 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:03

    There is a Python script called sedsed by Aurelio Jargas which will show the stepwise execution of a sed script. A debugger like this isn't going to help much in the case of characters being taken literally (e.g. {) versus having special meaning (e.g. \{), especially for a simple substitution, but it will help when a more complex script is being debugged.

    The latest SVN version.
    The most recent stable release.
    Disclaimer: I am a minor contributor to sedsed.

    Another sed debugger, sd by Brian Hiles, written as a Bourne shell script (I haven't used this one).

提交回复
热议问题