通配符字符串匹配 [英] Wildcard string matching

查看:201
本文介绍了通配符字符串匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最有效的通配符字符串匹配算法?我问大约只有一个想法,这是没有必要提供实际的code。

What is the most efficient wildcard string matching algorithm? I am asking only about an idea, it is not necessary to provide actual code.

我在想,这样的算法可以排序的后缀阵列被修建,这可以产生澳性能(的log(n))。

I'm thinking that such algorithm can be built with sorted suffix arrays, which can yield performance of O(log(n)).

我是正确的?

编辑:

我的意思是像A * B* SIP *A?B,其中星意味着任意数量的符号和问号表示单个符号。

I mean patterns like "A*B", "*sip*" or "A?B" where star means any number of symbols and question mark means single symbol.

推荐答案

有一个纸覆盖最快的选择这里 http://swtch.com/~rsc/regexp/regexp1.html 特别是它可以让你避免天真的算法,变长模式使用时,异常地慢。

There is a paper covering the fastest options here http://swtch.com/~rsc/regexp/regexp1.html in particular it allows you avoid naive algorithms that become pathologically slow when long patterns are used.

它涵盖了普通的常规EX pressions但你可以限制你实现你所需要的子集。

It covers generic regular expressions but you can limit your implementation to the subset you require.

这篇关于通配符字符串匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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