arrow
Return

An efficient string solver for string constraints with regex-counting and string-length

delete2025-03-01
delete0
PRE
AI
D
Denghang Hu *
Z
Zhilin Wu
DOI:10.1016/j.sysarc.2025.103340delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Regular expressions (regex for short) and string-length function are widely used in string-manipulating programs. Counting is a frequently used feature in regexes that counts the number of matchings of sub- patterns. The state-of-the-art string solvers are incapable of solving string constraints with regex-counting and string-length efficiently, especially when the counting and length bounds are large. In this work, we propose an automata-theoretic approach for solving such class of string constraints. The main idea is to symbolically model the counting operators by registers in automata instead of unfolding them explicitly, thus alleviating the state explosion problem. Moreover, the string-length function is modeled by a register as well. As a result, the satisfiability of string constraints with regex-counting and string-length is reduced to the satisfiability of linear integer arithmetic, which the off-the-shelf SMT solvers can then solve. To improve the performance further, we also propose various optimization techniques. We implement the algorithms and validate our approach on 49,843 benchmark instances. The experimental results show that our approach can solve more instances than the state-of-the-art solvers, at a comparable or faster speed, especially when the counting and length bounds are large or when the counting operators are nested with some other counting operators or complement operators.
Keywords:
String constraints
String solver
Regular expression
String length
Counting operator

Journal

Journal of Systems Architecture cover
Journal of Systems Architecture
IF:
4.1
Papers:
2.9K
Citations:
4.2K

Organization

C
chinese academy of sciences
Scholars:
55.9W
Papers: 44.7W
Citations: 704