Jamie Zawinkski有一句老话:“有些人,当遇到问题时,会想‘我知道了,我将使用正则表达式。’现在他们有两个问题了。” 即使像我这样喜欢正则表达式的人也会嘲笑这句话的真理,因为我们已经看到了当有人不考虑编写不好的模式的影响时造成的后果。当一些人编写一个糟糕的模式时,他们最终会在日志文件中添加额外的行。当美国国家安全局这样做时,他们会捕获并保留无数无辜人士的互联网流量。(Jamie Zawinkski yǒu yījù lǎohuà: “Yǒuxiē rén, dāng yùdào wèntí shí, huì xiǎng ‘wǒ zhīdào le, wǒ jiāng shǐyòng zhèngzé biǎodáshì.’ Xiànzài tāmen yǒu liǎng gè wèntí le.” Jíshǐ xiàng wǒ zhèyàng xǐhuān zhèngzé biǎodáshì de rén yě huì cháoxiào zhè jù huà de zhēnlǐ, yīnwèi wǒmen yǐjīng kàn dào le dāng yǒurén bù kǎolǜ biānxiě bù hǎo de mósì de yǐngxiǎng shí zàochéng de hòuguǒ. Dāng yīxiē rén biānxiě yīgè zāogāo de mósì shí, tāmen zuìzhōng huì zài rìzhì wénjiàn zhōng tiānjiā éwài de háng. Dāng Měiguó guójiā ānquán jú zhèyàng zuò shí, tāmen huì bǔhuò bìng bǎoliú wúshù wūgū rénshì de hùliánwǎng liúliàng.) - There's an old quote from Jamie Zawinkski that goes: "Some people, when confronted with a problem, think ‘I know, I'll use regular expressions.’ Now they have two problems." Even people like me who like regular expressions laugh at the truth in that quote, because we've seen the consequences when someone doesn't think through the implications of a poorly written pattern. When some people write a bad pattern, they end up with extra lines in a log file. When the NSA does it, they capture and retain Internet traffic on untold numbers of innocent people.