regex - Textwrangler grep regexpression 引用?

标签 regex reference grep textwrangler

关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。












想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。

6年前关闭。




Improve this question




我正在寻找 Textwrangler 中使用的正则表达式的综合表格/列表。
该手册很好,但缺少可以检查快速引用备忘单的概述。

谢谢 ;)

最佳答案

here you go

我挑选了以下部分:

模式修改器(开关)

i             Case-insensitive
m             Multiline   : allow the grep engine to match at  ^ and $ after and before at \r or \n.
s             Magic Dot   : allows . to match \r and \n
x             Free-spacing: ignore unescaped white space; allow inline comments in grep patterns.

(?imsx)       On
(?-imsx)      Off
(?i-msx)      Mixed

正则表达式元字符:
.             Any character except newline or carriage return
[ ]           Any single character of set
[^ ]          Any single character NOT of set
*             0 or more previous regular expression
*?            0 or more previous regular expression (non-greedy)
+             1 or more previous regular expression
+?            1 or more previous regular expression (non-greedy)
?             0 or 1 previous regular expression
|             Alternation
( )           Grouping regular expressions
^             Beginning of a line or string
$             End of a line or string
{m,n}         At least m but most n previous regular expression
{m,n}?        At least m but most n previous regular expression (non-greedy)
\1-9          Nth previous captured group
\&            Whole match                                     # BBEdit: '&' only - no escape needed
\`            Pre-match                                       # PCRE?  NOT BBEdit
\'            Post-match                                      # PCRE?  NOT BBEdit
\+            Highest group matched                           # PCRE?  NOT BBEdit
\A            Beginning of a string
\b            Backspace(0x08)(inside[]only)                   # PCRE?
\b            Word boundary(outside[]only)
\B            Non-word boundary
\d            Digit, same as[0-9]
\D            Non-digit

案例更改运算符
\E            Change case - acts as an end delimiter to terminate runs of \L & \U.
\l            Change case of only the first character to the right lower case. (Note: lowercase 'L')
\L            Change case of all text to the right to lowercase.
\u            Change case of only the first character to the right to uppercase.
\U            Change case of all text to the right to uppercase.

空白或非空白
\t            Tab
\n            Linefeed
\r            Return
\f            Formfeed
\s            Whitespace character equivalent to [ \t\n\r\f]
\S            Non-whitespace character
\W            Non-word character
\w            Word character[0-9A-Za-z_]
\z            End of a string
\Z            End of a string, or before newline at the end
(?#)          Comment
(?:)          Grouping without backreferences
(?=)          Zero-width positive look-ahead assertion
(?!)          Zero-width negative look-ahead assertion
(?>)          Nested anchored sub-regexp stops backtracking
(?imx-imx)    Turns on/off imx options for rest of regexp
(?imx-imx:…)  Turns on/off imx options, localized in group    # '…' indicates added regex pattern

链接到文档有更多内容

关于regex - Textwrangler grep regexpression 引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23426617/

相关文章:

reference - 返回传递给函数的不可变引用后面的可变引用

c++ - 访问 IDWriteTextFormat 而不是创建新的(FW1FontWrapper 行间距)

python - 如何使两个目录条目始终引用相同的浮点值

python - 从项目中 Grep 类/函数

linux - 找到文件然后 Grep 其内容

shell - 如何在awk中对模式进行if else匹配

mysql - 如何使用 MySQL 查询在文本字段中查找第一个数字?

regex - 除了单词中的单个撇号和连字符外,删除所有标点符号

python - 如何用正则表达式替换 '-'(破折号)以外的所有\W(无字母)?

c - 没有连续 2 个 a 和 b 的正则表达式