using Regular Expressions to Look References in Source Insight

来源:互联网 发布:淘宝买太多了会怎么样 编辑:程序博客网 时间:2024/05/27 19:26
using Regular Expressions to Look References in Source Insight :

想查找的内容为:

1.包含break

2.break后有一个空格,即不查找"break;

3.空格接下来是字母而不是分号(;),即不查找"break ;"

可在查找框中输入如下正则表达式:

    break\s[a-z]

查找结果如下:

---- break\s[a-z] Matches (11 in 5 files) ----
RcapiDevScriptDevice.java (java\nvprormapi):                    break loop;
RcapiFtpListener.java (java\nvprormapi):                    break thread_loop;
RcapiFtpMonitor.java (java\nvprormapi):                    break thread_loop;
RcapiFtpMonitor.java (java\nvprormapi):                        break monitoring_loop;
RcapiFtpMonitor.java (java\nvprormapi):                        break thread_loop;
RcapiFtpMonitor.java (java\nvprormapi):                        break monitoring_loop;
RcapiTftpListener.java (java\nvprormapi):                    break thread_loop;
RcapiTftpMonitor.java (java\nvprormapi):                    break thread_loop;
RcapiTftpMonitor.java (java\nvprormapi):                        break monitoring_loop;
RcapiTftpMonitor.java (java\nvprormapi):                        break thread_loop;
RcapiTftpMonitor.java (java\nvprormapi):                        break monitoring_loop;


附: Regular Expressions in http://www.sourceinsight.com/docs35/af1070763.htm:

Matching a Tab or Space

\t
\s
\w

\t matches a single tab character.

Example: \tint abc; matches a tab character followed by int abc;.

\s matches a single space character.

Example: \sif matches a space character followed by if.

\w matches a single white space character. In other words, \w matches either a tab or space character.

Example: \wwhile matches either a tab or space character, followed by while.


Matching Any in a Set of Characters

[ .. ]

When a list of characters are enclosed in square braces [..] then any character in that set will be matched.

Example: [abc] matches a, b, and c, but not d.

When a caret ^ appears at the beginning of the set, the match succeeds only if the character is not in the set.

Example: [^abc] matches d, e, or f, but not a, b, or c.

Sets can conveniently be described with a range. A range is specified by two characters separated by a dash, such as [a-z]. The beginning character must have a lower ASCII value than the ending character.

Example: [a-z] matches any character in the range a through z, but not A or 1 or 2.

Sets can contain multiple ranges.

Example 1: [a-zA-Z] matches any alphabetic character.

Example 2: [^a-zA-Z0-9] matches any non-alphanumeric character.




0 0