Regular Expression的中譯 - Linux
By Mia
at 2010-01-15T08:47
at 2010-01-15T08:47
Table of Contents
http://mitpress.mit.edu/books/FLAOH/cbnhtml/glossary-R.html
Regular Expression A definition for a class of strings that can be
recognized by a finite-state automaton. An example of a class of strings that
is regular would be legal mathematical expressions using only ``+'' and
digits. An example that is not regular is the same legal mathematical
expressions as before, but with properly nested parentheses.
Ex1:
1+2+3
1+2
+1+2
...
Python RegExp:
import re
print re.match("\+?\d?[\+\d]*", "1+2+3").group(0)
Ex2:
(1+2)
((1)+2)
(((1))+2)
(1+(2))
(1+((2)+(3)))
...
請高手找出剛好match它們的RegExp!?
所以簡單的說regular不是指什麼正不正統,
而是指你能不能找到一個pattern match一組字串。
沒有"規律"的字串組,是找不到對應的pattern!
--
Regular Expression A definition for a class of strings that can be
recognized by a finite-state automaton. An example of a class of strings that
is regular would be legal mathematical expressions using only ``+'' and
digits. An example that is not regular is the same legal mathematical
expressions as before, but with properly nested parentheses.
Ex1:
1+2+3
1+2
+1+2
...
Python RegExp:
import re
print re.match("\+?\d?[\+\d]*", "1+2+3").group(0)
Ex2:
(1+2)
((1)+2)
(((1))+2)
(1+(2))
(1+((2)+(3)))
...
請高手找出剛好match它們的RegExp!?
所以簡單的說regular不是指什麼正不正統,
而是指你能不能找到一個pattern match一組字串。
沒有"規律"的字串組,是找不到對應的pattern!
--
Tags:
Linux
All Comments
By Hedda
at 2010-01-19T18:36
at 2010-01-19T18:36
Related Posts
有關 symbolic link
By Dorothy
at 2010-01-14T18:53
at 2010-01-14T18:53
CentOS Heartbeat 高可用性叢集架設
By Lydia
at 2010-01-14T17:22
at 2010-01-14T17:22
Regular Expression的中譯
By Megan
at 2010-01-14T17:03
at 2010-01-14T17:03
Linux仿Mac之KDE篇
By Hardy
at 2010-01-14T17:03
at 2010-01-14T17:03
從藍牙裝置接收檔案
By Joseph
at 2010-01-14T17:00
at 2010-01-14T17:00