作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2006, Vol. 32 ›› Issue (2): 62-64.

• 软件技术与数据库 • 上一篇    下一篇

一种改进的字符串匹配算法

王 成 1,2,刘金刚1,2   

  1. 1.首都师范大学计算机科学联合研究院,北京 100037; 2.中国科学院计算技术研究所,北京 100080
  • 出版日期:2006-01-20 发布日期:2006-01-20

An Improved String Matching Algorithm

WANG Cheng1,2, LIU Jingang1,2   

  1. 1.Joint Faculty of Computer Scientific Research, Capital Normal University, Beijing 100037;2.Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100080
  • Online:2006-01-20 Published:2006-01-20

摘要: 基于字符串匹配的检测方法是入侵检测系统中的一种重要方法。在分析了几种常见的字符串匹配算法(BF、KMP、BM、Sunday等)的基础上,提出了一种改进的字符串匹配算法——SundayNew。该算法使每一次匹配不成功后都能跳过尽可能多的字符以进行下一轮匹配,并且匹配次数大大减少,从而提高了匹配效率。最后,分析了该算法的性能,并用具体的实验数据给出了几种匹配算法的测试结果。

关键词: 字符串搜索;模式匹配;算法

Abstract: String matching algorithm is an important method in intrusion detection. An improved algorithm is proposed for string matching based on the discussions of several common string matching algorithms, for example, BF, KMP, BM, Sunday, etc. This algorithm can jump over more characters to do next matching when this matching is lost. At the same time, the matching times decreases sharply. In this case, it improves the matching efficiency. In the end, the analysis of this algorithm’s performance and the comparisons of the testing results of several matching algorithms are given.

Key words: String searching; Pattern matching; Algorithm