Wolfram Library Archive

Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title Downloads

Implementing Regular Expressions in Mathematica with J/Link

Brian G. Higgins
Organization: University of California, Davis
Department: Department of Chemical Engineering & Materials Science

2004 Wolfram Technology Conference
Conference location

Champaign IL

Although Mathematica has a set of powerful functions that allows one to manipulate and search for patterns in strings (e.g., StringReplace, StringInsert, StringMatchQ, and so on), these functions do not support regular expressions. A regular expression (regex for short) is a compact way of describing complex patterns in texts. They can be used to search for patterns and, once found, to modify the patterns in a variety of ways. Some programming languages support the use of a few metacharacters to perform searches, but they do not have the full expressive power of regular expressions. Perl is a notable exception: regular expressions are built in as part of the language. Java 2 Standard Edition (1.4.0 and later) now supports regular expressions through the standard java.util.regex package. This presentation will discuss the object model in the regex package and show how regular expressions can be implemented in Mathematica using J/Link. The syntax of regular expressions will be explained using simple examples. Finally some applications in bioinformatics will be illustrated.

*Wolfram Technology > Kernel > Pattern Matching
*Wolfram Technology > Linking Technology > J/Link

Downloads Download Wolfram CDF Player

brianhiggins.nb (372.7 KB) - Abstract of talk