Unique Pattern Matching in Strings
Abstract
Regular expression patterns are a key feature of document processing languages like Perl and XDuce. It is in this context that the first and longest match policies have been proposed to disambiguate the pattern matching process. We formally define a matching semantics with these policies and show that the generally accepted method of simulating longest match by first match and recursion is incorrect. We continue by solving the associated type inference problem, which consists in calculating for every subexpression the set of words the subexpression can still match when these policies are in effect, and show how this algorithm can be used to efficiently implement the matching process.
- Publication:
-
arXiv e-prints
- Pub Date:
- February 2003
- DOI:
- 10.48550/arXiv.cs/0302004
- arXiv:
- arXiv:cs/0302004
- Bibcode:
- 2003cs........2004V
- Keywords:
-
- Programming Languages;
- Databases;
- D.3.3;
- F.1.1;
- H.2.3;
- H.3.3;
- H.2.4;
- I.5.5
- E-Print:
- 22 pages