Regular Expression

Basics Regular Expressionhtml

1) The $ and ^python

^XXX matches the beginning of a lineexpress

XXX$ matches the end of a linespa

2) match any character with .htm

3) specify a range of characters with [...]ci

4) repeating character sets with *rem

5) matching a specific number of sets with \{ and \}it

6) matching words with \< and \>io

7) remembering patterns with \(..\) and \1sed

8) OR: \|

 

 

Extended Regular Expression

POSIX character sets

Python extension

Perl extension

Reference

http://www.grymoire.com/Unix/Regular.html

(regular expression)

http://www.grymoire.com/Unix/Sed.html

(sed)

 

 

Potential Problems

1. Each utility may has its own convention for regular expressions, for example, vi, python, perl, sed, to name a few.

2. Basic regular expressions match the longest possible pattern, so be careful when using it with sed.

相關文章
相關標籤/搜索