P****i 发帖数: 12972 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: PaiMei (白眉), 信区: Linux
标 题: re一问
发信站: BBS 未名空间站 (Tue Nov 21 00:04:19 2006), 站内
如何把一个string的'(*)'都删掉,*是任意sub-string,但不含左右括号。
例子:
aaa(a123)b(cd)(123)edf
=>aaabedf | a*****1 发帖数: 11 | 2 Well I am not a theoretical guy, the things I can tell you are:
(1) Both Perl and PHP are using NFA, check J. Friedl's book MRE.
(2) You might be right in theorem, while in the real life, different
regex flavors have embedded different functionalities into their
engines, no need to following the dogma in the book.
(3) Regex flavors like Perl and PHP support dynamic regrx constructs,
which makes them more powerful than many other languages in handling
texts.
Good luck. |
|