Volume 6 Number 12 (Dec. 2011)
Home > Archive > 2011 > Volume 6 Number 12 (Dec. 2011) >
JSW 2011 Vol.6(12): 2391-2398
doi: 10.4304/jsw.6.12.2391-2398

Multi-pattern Matching with Wildcards

Meng Zhang 1 , Yi Zhang 2 , Jijun Tang 3 , Xiaolong Bai 1

  • 1 College of Computer Science and Technology, Jilin University, Changchun, China
  • 2 Department of Computer Science, Jilin Business and Technology College, Changchun, China
  • 3 Department of Computer Science & Engineering, Univ. of South Carolina, USA

Abstract

Multi-pattern matching with wildcards is to find all the occurrences of a set of patterns with wildcards in a text. This problem arises in various fields, such as computational biology and network security. But the problem is not extensively studied as the single pattern case and there is no efficient algorithm for this problem. In this paper, we present efficient algorithms based on the fast Fourier transform. Let <em>P</em> = {<em>p</em><sup>1</sup>, . . . , <em>p<sup>k</sup></em>} be a set of patterns with wildcards where the total length of patterns is |<em>P</em>|, and a text <em>t</em> of length <em>n</em> over alphabet <em>a</em><sub>1</sub>, . . . , a_x001b_. We present three algorithms for this problem where patterns are matched simultaneously. The first algorithm finds the matches of a small set of patterns in the text in <em>O</em>(<em>n</em> log |<em>P</em>| + <em>occ</em> log <em>k</em>) time where <em>occ</em> is the total number of occurrences of <em>P</em> in <em>t</em>. The words used in the algorithm are of size <em>k</em>d2 lg <em>_x001b_e</em>+<em>P<sub>k</sub></em> i=1dlg |pi|e bits. The second algorithm is based on a prime number encoding. It runs in time <em>O</em>(<em>n</em> log<em>m</em> + <em>occ </em>log<em> k</em>) where <em>m</em> is the length of the longest pattern in <em>P</em>. The algorithm uses words with kdlg(2m_x001b_2 +k2)e bits. The third one finds the occurrences of patterns in the text in time <span id="cke_bm_355S" style="display: none;"> </span><em>O</em><span id="cke_bm_355E" style="display: none;"> </span>(<em>n</em> log |<em>P</em>| log _x001b_ + <em>occ</em> log <em>k</em>) by computing the Hamming distance between patterns and the text. The algorithm uses words with <span id="cke_bm_356E" style="display: none;"> </span><em>Pk i</em>=1dlg |pi|e bits. Moreover, we demonstrate an FFT implementation based on the modular arithmetic for machines with 64-bit word. Finally, we show that these algorithms can be easily parallelized, and the parallelized algorithms are given as well.

Keywords

  • Algorithm;
  • Multi-pattern
  • matching;
  • Wildc
jsw0612-7

How to Cite

Copied

Meng Zhang, Yi Zhang, Jijun Tang, and Xiaolong Bai, "Multi-pattern Matching with Wildcards," Journal of Software, vol. 6, no. 12, pp. 2391-2398, 2011. https://doi.org/ 10.4304/jsw.6.12.2391-2398

Copyright & License

Copyright © 2011 by the authors. This is an open access article distributed under the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited (CC BY 4.0).

Article Metrics in Dimensions

General Information

  • ISSN: 1796-217X (Online)

  • Abbreviated Title: J. Softw.

  • Frequency:  Biannually

  • APC: 500USD

  • DOI: 10.17706/JSW

  • Editor-in-Chief: Prof. Antanas Verikas

  • Executive Editor: Ms. Cecilia Xie

  • Abstracting/ Indexing: DBLP, CNKI, 

  • Google Scholar, ProQuest,
           INSPEC(IET), ULRICH's Periodicals
           Directory, WorldCat, etc

  • E-mail: editor@jsoftware.us

  • Aug 27, 2026 News!

    Vol 21, No 1 has been published with online version

  • Mar 30, 2026 News!

    Vol 20, No 2 has been published with online version   [Click]

  • Apr 01, 2024 News!

    Vol 14, No 4- Vol 14, No 12 has been indexed by IET-(Inspec)     [Click]

  • Apr 01, 2024 News!

    Papers published in JSW Vol 18, No 1- Vol 18, No 6 have been indexed by DBLP   [Click]

  • Mar 07, 2025 News!

    JSW had implemented online submission system   [Click]