TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Stop writing Regular Expressions – Express them with Verbal Expressions

33 点作者 adamstac将近 12 年前

7 条评论

antichaos将近 12 年前
Stop writing URLs as strings. Express them with VerbalResourceLocator:<p><pre><code> var vrl = VRL(). schema(&quot;https&quot;). tld(&quot;com&quot;). sld(&quot;ycombinator&quot;). subdomain(&quot;news&quot;). path(&quot;&#x2F;item&quot;). query({&quot;id&quot;: &quot;6164276&quot;}); </code></pre> Seriously though, Verbal Expression is a great way to turn terse regexps into un-reusable verbiage that barely improves readability.
评论 #6165432 未加载
gyepi将近 12 年前
I had never heard of this before. The stated goal is to simplify difficult regular expressions, but the examples seem to be more complicated than the corresponding regexes. Maybe I&#x27;m just old school.<p>I&#x27;m not sure that someone who relies on this would be able to debug the resulting generated regex when something doesn&#x27;t work as expected.
评论 #6164627 未加载
评论 #6164805 未加载
cleaver将近 12 年前
I&#x27;m always a bit wary of posts that tell me to &quot;Stop doing X&quot;. I&#x27;m also pretty comfortable with regular expressions. They take you outside of the procedural comfort zone, but are a valuable tool that will pay off to learn.<p>Still, it&#x27;s worth a shot trying to create a tool like this. What I don&#x27;t get is how they would handle subexpressions.
评论 #6167350 未加载
评论 #6164863 未加载
keithgabryelski将近 12 年前
when you pretend you aren&#x27;t using regular expressions, then you have two problems.
eurleif将近 12 年前
pyparsing (<a href="http://pyparsing.wikispaces.com/" rel="nofollow">http:&#x2F;&#x2F;pyparsing.wikispaces.com&#x2F;</a>) is more object-oriented and composable, and it can parse recursive grammars.
评论 #6164861 未加载
grkovalev将近 12 年前
What is news? it&#x27;s LINQ just for string
DavidSJ将近 12 年前
Looks like cl-ppcre.