是否有良好的/有趣的类似物正规前pressions二维? [英] Are there any good / interesting analogs to regular expressions in 2d?

查看:125
本文介绍了是否有良好的/有趣的类似物正规前pressions二维?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么好看的(或至少是有趣的,但有缺陷)类似物恩定期pressions在两个方面?

Are there any good (or at least interesting but flawed) analogs to regular expressions in two dimensions?

在一个方面,我可以写的东西像 / AAAC?(BC)* B?AAA / 来快速拉交替出的区域B C s的至少三个边框的秒。也许同样重要的是,我可以回来一个月后,看一眼什么它寻找。

In one dimension I can write something like /aaac?(bc)*b?aaa/ to quickly pull out a region of alternating bs and cs with a border of at least three as. Perhaps as importantly, I can come back a month later and see at a glance what it's looking for.

我发现自己编写自定义$ C $下类似的问题,在2D(一些更为复杂/受限),这将是很好有一个更简洁和标准化的符号,即使我有背后写发动机它自己。

I'm finding myself writing custom code for analogous problems in 2d (some much more complicated / constrained) and it would be nice to have a more concise and standardized notation, even if I have to write the engine behind it myself.

第二个例子可能被称为找到+。我们的目标是要找到3个或更多 A s的柱, B 由3个或更多<$ C括号内$ C> A s的三个或更多的 A s以下。它应该匹配:

A second example might be called "find the +". The goal is to locate a column of 3 or more as, a b bracketed by 3 or more as with three or more as below. It should match:

..7...hkj.k f
7...a  h o j 
----a--------
 j .a,g- 8 9 
.aaabaaaaa7 j
 k .a,,g- h j
 hh a----?  j
    a   hjg

和可以写成并[b ^(一个{3})ν(一个{3})>(一个{3})≤(一个{3})]或...

and might be written as [b^(a{3})v(a{3})>(a{3})<(a{3})] or...

建议?

推荐答案

不是一个正则表达式的专家,但要找到这个问题有意思,我环顾四周,发现这个有趣的博客条目。特别是使用有定义的2D正则表达式的语法看起来有吸引力。本文链接有可能会告诉你比我多。

Not being a regex expert, but finding the problem interesting, I looked around and found this interesting blog entry. Especially the syntax used there for defining the 2D regex looks appealing. The paper linked there might tell you more than me.

更新的评论:这里是链接到主作者的页面,在这里你可以下载链接文件的二维语言的: http://www.mat.uniroma2.it/~giammarr/Research/pubbl.html

Update from comment: Here is the link to the primary author's page where you can download the linked paper "Two-dimensional languages": http://www.mat.uniroma2.it/~giammarr/Research/pubbl.html

这篇关于是否有良好的/有趣的类似物正规前pressions二维?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆