2017年/11月/28日

首页回退

美丽的正则匹配代码

原文

代码出自 Rob Pike之手

Beautiful code is likely to be simple – clear and easy to understand. Beautitful code is likely to be compact – just enough code to do the job and no more – but not cryptic, to the point where it cannot be understood. Beautiful code may well be general, solving a broad class of problems in a uniform way. One might even describe it as elegant, showing good taste and refinement.

漂亮的代码可能很简单-清晰易懂。精美的代码可能很紧凑-足以完成任务的代码仅此而已-不会变得晦涩难懂,以至于无法理解。漂亮的代码很可能是通用的,以统一的方式解决了各种各样的问题。甚至可能将其描述为优雅,表现出良好的品味和精致。

JavaScript版本