Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1490284
  • 博文数量: 226
  • 博客积分: 3997
  • 博客等级: 少校
  • 技术积分: 2369
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-19 17:26
个人简介

Never save something for a special occasion. Every day in your life is a special occasion.

文章分类

全部博文(226)

文章存档

2018年(5)

2017年(11)

2016年(1)

2015年(17)

2014年(14)

2013年(30)

2012年(5)

2011年(52)

2010年(107)

分类:

2010-09-13 19:49:52

Editplus' Regular
Regular expression is a search string that contains normal text plus special characters which indicate extended searching options. Regular expression allows more sophisticated search and replace.
For example, you can find any digit by using regular expression "[0-9]". Similarly you can find any matching character that is NOT digit by using regular expression "[^0-9]".
EditPlus supports following regular expressions in Find, Replace and Find in Files command.
 
 

Expression

Description

\t

Tab character.

\n

New line.

.

Matches any character.

|

Either expression on its left and right side matches the target string. For example, "a|b" matches "a" and "b".

[]

Any of the enclosed characters may match the target character. For example, "[ab]" matches "a" and "b". "[0-9]" matches any digit.

[^]

None of the enclosed characters may match the target character. For example, "[^ab]" matches all character EXCEPT "a" and "b". "[^0-9]" matches any non-digit character.

*

Character to the left of asterisk in the expression should match 0 or more times. For example "be*" matches "b", "be" and "bee".

+

Character to the left of plus sign in the expression should match 1 or more times. For example "be+" matches "be" and "bee" but not "b".

?

Character to the left of question mark in the expression should match 0 or 1 time. For example "be?" matches "b" and "be" but not "bee".

^

Expression to the right of ^ matches only when it is at the beginning of line. For example "^A" matches an "A" that is only at the beginning of line.

$

Expression to the left of $ matches only when it is at the end of line. For example "e$" matches an "e" that is only at the end of line.

()

Affects evaluation order of expression and also used for tagged expression.

\

Escape character. If you want to use character "\" itself, you should use "\\".

 
 
The tagged expression is enclosed by (). Tagged expressions can be referenced by \0, \1, \2, \3, etc. \0 indicates a tagged expression representing the entire substring that was matched. \1 indicates the first tagged expression, \2 is the second, etc. See following examples.
 
 

Original

Search 

Replace 

Result  

abc     

(ab)(c)

\0-\1-\2

abc-ab-c 

abc     

a(b)(c)

\0-\1-\2

abc-b-c 

abc     

(a)b(c)

\0-\1-\2

abc-a-c

 

阅读(1058) | 评论(0) | 转发(0) |
0

上一篇:BAT命令简单教程

下一篇:VB程序调用脚本

给主人留下些什么吧!~~