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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

RegExr 2.0

106 点作者 _kushagra大约 11 年前

11 条评论

bane大约 11 年前
Regex testing is cool, but there are dozens of these kinds of tools and I&#x27;d really love to see some other kinds of regex tools<p>- A list generator. Enter a regex, set repetition operator constraints (e.g. <i>-&gt;{0,3}, +-&gt;{1,3}, .-&gt;[A-Z0-9 ], etc.) and have it exhaustively generate a list of matching strings. This is helpful when you have a regex that matches your test strings, but also to let you know what </i>else* it&#x27;ll match. The constraints are to keep it from generating infinite lists. Even if it jams out tens or hundreds of thousands of produced strings, it&#x27;s still useful. I&#x27;ve found that most people just build up the first regex that will &quot;match&quot; their input text, and move on without thinking about all the edge cases they&#x27;ve just introduced.<p>- A regex assembler optimizer. Give it a few regexes, have it assemble them into one large regex and optimize it. It&#x27;s got to do better than just | or&#x27;ing all the regexes together. I&#x27;ve seen some work done on using trie variants to do this, but have no idea how far along the work is on this.<p>- A regex list generator. Give it a list of strings you want to match and have it generate a regex. A sliding &quot;fuzziness&quot; control could tell it to take alternates in the same character position and substitute either<p>1. Just the characters in the given list - a, t and q in the same position generates a|t|q<p>2. A representative narrow character range - if I give it a|t|q it knows to use [A-Z] while a|t|q|4 might generate [A-Z0-9]<p>3. A larger character range, a|t|q might just go ahead and produce [A-Z0-9]<p>4. An even larger character range, whatever it is, just use .<p>And maybe another slider for repetitions, so if I end up with [A-Z][A-Z][A-Z], should it just produce [A-Z]{3} or can I go ahead and have it [A-Z]+<p>Jam the result through an optimizer (see previous idea above) to clean up the regex and maybe even run it through the list generator to check if it produces only what you want.
评论 #7537855 未加载
评论 #7538781 未加载
评论 #7538024 未加载
评论 #7538040 未加载
评论 #7537600 未加载
lelf大约 11 年前
People just cannot do unicode even remotely properly. Just cannot.<p>𝄞 is one char, not two. привет is matched by \w+.<p>PS there&#x27;s some advanced stuff but where is basic [[:posix:]] char classes?
评论 #7537387 未加载
评论 #7537310 未加载
评论 #7538527 未加载
shock大约 11 年前
&gt; Uh-oh, it looks like your browser is not supported.<p>&gt; RegExr only supports modern desktop browsers.<p>I&#x27;m using Firefox 30 on Ubuntu. I think it&#x27;s plenty modern :)
评论 #7537261 未加载
评论 #7537815 未加载
评论 #7537244 未加载
markbnj大约 11 年前
Very nicely done. As someone else pointed out there are quite a few of these tools, but I think you&#x27;ve done a really nice job with this one. One suggestion: make the reference easier to scan at a top level as opposed to drilling down.
nlh大约 11 年前
I&#x27;m guessing the following is either near-impossible or pure-impossible, but:<p>Is there a tool that allows you to highlight portions of a string and generate a corresponding regex? (i.e. the inverse of RegExr)
评论 #7537324 未加载
评论 #7537314 未加载
评论 #7537307 未加载
评论 #7537311 未加载
评论 #7537298 未加载
ChrisGaudreau大约 11 年前
Reminds me of <a href="http://rubular.com/" rel="nofollow">http:&#x2F;&#x2F;rubular.com&#x2F;</a>, except it isn&#x27;t Ruby-focused and is more community-based. Seems pretty cool.
评论 #7537383 未加载
评论 #7537559 未加载
mck-大约 11 年前
There is one for Javascript that I use pretty often: <a href="http://scriptular.com/" rel="nofollow">http:&#x2F;&#x2F;scriptular.com&#x2F;</a> (based on the Ruby one: <a href="http://www.rubular.com/" rel="nofollow">http:&#x2F;&#x2F;www.rubular.com&#x2F;</a>)
cygni大约 11 年前
<a href="https://www.debuggex.com/" rel="nofollow">https:&#x2F;&#x2F;www.debuggex.com&#x2F;</a> is a nice alternative that is a little different from other regex sites I&#x27;ve seen.
strictfp大约 11 年前
Why can I not match against &quot;\w*&quot; for instance? It just says &quot;infinite&quot; and does not seem to attempt to match.
评论 #7538505 未加载
hardwaresofton大约 11 年前
one of the best regular expression testers online just got better. Great site, love it
tuananh大约 11 年前
a side note: i found Patterns app on OS X very useful for regex.