Linear Time Subsequence and Supersequence Regex Matching

Antoine Amarilli, Florin Manea, Tina Ringleb, Markus L. Schmid

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

It is well-known that checking whether a given string w matches a given regular expression r can be done in quadratic time O(|w| · |r|) and that this cannot be improved to a truly subquadratic running time of O((|w|· |r|)1−ϵ) assuming the strong exponential time hypothesis (SETH). We study a different matching paradigm where we ask instead whether w has a subsequence that matches r, and show that regex matching in this sense can be solved in linear time O(|w| + |r|). Further, the same holds if we ask for a supersequence. We show that the quantitative variants where we want to compute a longest or shortest subsequence or supersequence of w that matches r can be solved in O(|w|· |r|), i. e., asymptotically no worse than classical regex matching; and we show that O(|w|+ |r|) is conditionally not possible for these problems. We also investigate these questions with respect to other natural string relations like the infix, prefix, left-extension or extension relation instead of the subsequence and supersequence relation. We further study the complexity of the universal problem where we ask if all subsequences (or supersequences, infixes, prefixes, left-extensions or extensions) of an input string satisfy a given regular expression.

Original languageEnglish
Title of host publication50th International Symposium on Mathematical Foundations of Computer Science, MFCS 2025
EditorsPawel Gawrychowski, Filip Mazowiecki, Michal Skrzypczak
PublisherSchloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing
ISBN (Electronic)9783959773881
DOIs
Publication statusPublished - 20 Aug 2025
Externally publishedYes
Event50th International Symposium on Mathematical Foundations of Computer Science, MFCS 2025 - Warsaw, Poland
Duration: 25 Aug 202529 Aug 2025

Publication series

NameLeibniz International Proceedings in Informatics, LIPIcs
Volume345
ISSN (Print)1868-8969

Conference

Conference50th International Symposium on Mathematical Foundations of Computer Science, MFCS 2025
Country/TerritoryPoland
CityWarsaw
Period25/08/2529/08/25

Keywords

  • automata
  • regular expression
  • regular language
  • subsequence
  • supersequence

Fingerprint

Dive into the research topics of 'Linear Time Subsequence and Supersequence Regex Matching'. Together they form a unique fingerprint.

Cite this