TitleA type system for regular expressions
Publication TypeConference Paper
Year of Publication2012
AuthorsSpishak E, Dietl W, Ernst MD
Conference NameFTfJP: 14th Workshop on Formal Techniques for Java-like Programs
Pagination20–26
Date or Month PublishedJune
Conference LocationBeijing, China
AbstractRegular expressions are used to match and extract text. It is easy for developers to make syntactic mistakes when writing regular expressions, because regular expressions are often complex and different across programming languages. Such errors result in exceptions at run time, and there is currently no static support for preventing them. \par This paper describes practical experience designing and using a type system for regular expressions. This type system validates regular expression syntax and capturing group usage at compile time instead of at run time –- ensuring the absence of \textttPatternSyntaxExceptions from invalid syntax and \textttIndexOutOfBoundsExceptions from accessing invalid capturing groups. \par Our implementation is publicly available and supports the full Java language. In an evaluation on five open-source Java applications (480kLOC), the type system was easy to use, required less than one annotation per two thousand lines, and found 56 previously-unknown bugs.
Downloadshttps://checkerframework.org/manual/#regex-checker Regex Checker implementation https://homes.cs.washington.edu/~mernst/pubs/regex-types-ftfjp2012.pdf PDF https://homes.cs.washington.edu/~mernst/pubs/regex-types-ftfjp2012-slide... slides (PDF)
Citation KeySpishakDE2012