Textwrangler grep regexpression参考? [英] Textwrangler grep regexpression reference?

查看:118
本文介绍了Textwrangler grep regexpression参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找Textwrangler中使用的综合表格/表格列表。
这本手册很不错,但它缺少一个可以检查快速参考小抄的概览。

THX;)

解决方案

你在这里



我已经选择了以下部分:

PATTERN MODIFIERS(开关)



  i不区分大小写
m Multiline:允许grep引擎匹配^和$之前和之后的\r或\\\

s魔点:允许。匹配\r和\\\

x空格:忽略未转义的空格;允许以grep模式进行内嵌评论。
$ b(?imsx)关于
(?-imsx)关
(?i-msx)混合


 。除换行符或回车外的任何字符都返回
[]集合中的任何单个字符
[^]任何单个字符不是集合
* 0或更多以前的正则表达式
*? 0或更多以前的正则表达式(非贪婪)
+ 1或更多以前的正则表达式
+? 1个或更多之前的正则表达式(非贪婪)
? 0或1以前的正则表达式
|交替
()对正则表达式进行分组
^行或字符串的开头
$行或字符串的结尾
{m,n}至少有m个,但是大多数n个以前的正则表达式
{m,n}?至少m但是大多数n以前的正则表达式(非贪婪)
\ 1-9第N个先前捕获的组
\&整场比赛#BBEdit:'&'只 - 不需要转义
\\'前赛#PCRE? NOT BBEdit
\\''赛后#PCRE? NOT BBEdit
\ +最高组匹配#PCRE? NOT BBEdit
\A字符串开头
\b退格(0x08)(仅在[]内)#PCRE?
\b字边界(仅限于[]以外)
\B非字边界
\d数字,与[0-9]相同
\D非-digit



个案变更操作符



  \E更改大小写 - 用作结束分隔符来终止\L& \U。 
\l仅将第一个字符改为右小写。 (注:小写'L')
\L将所有文本的大小写改为小写。
\u仅将右侧的第一个字符改为大写。
\U将所有文本的大小写更改为大写。



空白或非空白



  \ t Tab 
\\\
换行
\r返回
\f换页
\s空格字符等值to [\t\\\
\r\f]
\S非空白字符






  \W非单词字符
\w单词字符[0-9A-Za-z_]
\ z字符串结尾
\Z结尾字符串或结尾换行符前
(?#)注释
(?:)不带反向引用的分组
(?=)零宽度正向先行断言
(?!)零宽度负向先行断言
(?>)嵌套锚定子正则表达式停止回溯
(?imx-imx)为正则表达式的其余部分打开/关闭imx选项
(?imx-imx:...)打开/关闭imx选项,本地化group#'...'表示添加了正则表达式模式

链接到文档的内容更多


I am searching for a comprehensive table / list of regexpressions as used in Textwrangler. The manual is nice but it lacks an overview that could be checked for quick reference cheat-sheet.

THX ;)

解决方案

here you go

I've picked out the sections below:

PATTERN MODIFIERS (switches)

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

Regex Meta-Characters:

.             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

Case-Change Operators

\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.

White-Space or Non-White-Space

\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

There is more on the linked to document

这篇关于Textwrangler grep regexpression参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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