Regular Expression的中譯 - Linux

Mia avatar
By Mia
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!

--
Tags: Linux

All Comments

Hedda avatar
By Hedda
at 2010-01-19T18:36
不要翻了 講英文就好了 越專業的東西越不好用翻譯後的結果講

有關 symbolic link

Dorothy avatar
By Dorothy
at 2010-01-14T18:53
有個不解的問題想請教 假設我現在有個可執行檔 叫 run 如果我再同一層目錄下 執行 ln -s run run_link 那麼我執行 ./run_link 時 可以正常 work 但是如果我放到別的目錄時 或是建立link到別的目錄 如: ln -s run ../run_link 我跳到那個 ...

CentOS Heartbeat 高可用性叢集架設

Lydia avatar
By Lydia
at 2010-01-14T17:22
今天練習了HA實作 參考了很多網站最後整理了一下分享給有需要的朋友們~~ 文章如下 http://www.wretch.cc/blog/magic20095/22525224 如有錯誤煩請鄉民告知~~ - ...

Regular Expression的中譯

Megan avatar
By Megan
at 2010-01-14T17:03
※ 引述《zxvc (執著)》之銘言: : 噓 tantu:頗無聊..你去google看看規律表示法會查到甚麼資料 01/14 13:44 : 推 wa120:不認同樓上 很多翻譯都是亂翻將錯就錯的 01/14 13:46 : → wa120:看過恐 ...

Linux仿Mac之KDE篇

Hardy avatar
By Hardy
at 2010-01-14T17:03
http://yunkwan.wordpress.com/2010/01/12/linux-kde-macish-linux%E4%BB%BFmac%E4% B9%8Bkde%E7%AF%87/ 縮網址:http://ppt.cc/V6mn 對岸網友寫的一篇文章。利用 Bespin 主題,讓你的 KDE ...

從藍牙裝置接收檔案

Joseph avatar
By Joseph
at 2010-01-14T17:00
我要從我的手機(SonyEricsson C510)用藍牙傳送檔案到電腦(Xubuntu 9.10) 據說是要安裝gnome-bluetooth 然後 應用程式-andgt;附屬應用程式-andgt;藍芽檔案分享 我裝了 可是卻怎麼也找不到 and#34;藍牙檔案分享and#34; 我也不知道怎麼啟動gno ...