2021年3月23日星期二

Can any grepping tool show the pattern that matched instead of the matching text?

All grepping tools like grep and ripgrep can show the text that matches the specified pattern(s).

Is it possible to show the regex pattern that matched, rather than the text that matched?

Example pattern-file contents:

abc  def  ghi  

Example text to search:

abc123def  

Desired return:

abc  def  
https://stackoverflow.com/questions/66774169/can-any-grepping-tool-show-the-pattern-that-matched-instead-of-the-matching-text March 24, 2021 at 11:05AM

没有评论:

发表评论