不同工具的正则表达式语法之间有什么区别? [英] What are the differences between regular expression syntaxes for different tools?

查看:142
本文介绍了不同工具的正则表达式语法之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不同的工具实现正则表达式的方式有所不同.例如,匹配"foo"或"bar":

Different tools implement regular expressions differently. For example to match "foo" or "bar":

printf "%s\n" foo bar baz food | grep -o '\<\(fo\+\|bar\)\>'
printf "%s\n" foo bar baz food | awk '/\<(fo+|bar)\>/'
printf "%s\n" foo bar baz food | sed -n '/\<\(fo\+\|bar\)\>/p'
printf "%s\n" foo bar baz food | sed -nr '/\<(fo+|bar)\>/p'

这些差异记录在哪里?

推荐答案

得分!很高兴找到此页面:
https://www.gnu.org/software/gnulib/manual/html_node/Regular-expression-syntaxes.html

Score! I'm so happy to have found this page:
https://www.gnu.org/software/gnulib/manual/html_node/Regular-expression-syntaxes.html

14.8正则表达式语法

Gnulib支持许多不同类型的正则表达式.尽管基本功能相同或相同,但使用的语法有所不同.此处给出的不同类型的描述是自动生成的.

14.8 Regular expression syntaxes

Gnulib supports many different types of regular expressions; although the underlying features are the same or identical, the syntax used varies. The descriptions given here for the different types are generated automatically.

  • awk正则表达式语法
  • egrep正则表达式语法
  • 正则表达式语法
  • emacs正则表达式语法
  • gnu-awk正则表达式语法
  • grep正则表达式语法
  • posix-awk正则表达式语法
  • posix基本正则表达式语法
  • posix-egrep正则表达式语法
  • posix扩展的正则表达式语法
  • posix-minimal-basic正则表达式语法
  • sed正则表达式语法
  • awk regular expression syntax
  • egrep regular expression syntax
  • ed regular expression syntax
  • emacs regular expression syntax
  • gnu-awk regular expression syntax
  • grep regular expression syntax
  • posix-awk regular expression syntax
  • posix-basic regular expression syntax
  • posix-egrep regular expression syntax
  • posix-extended regular expression syntax
  • posix-minimal-basic regular expression syntax
  • sed regular expression syntax

这篇关于不同工具的正则表达式语法之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆