Some Useful REX Expressions

  • To locate phone numbers:

  • To locate social security numbers:

  • To locate text between parentheses:
    (=[^()]+)      <- without direction specification
    >>(=!)+)       <- with direction specification

  • To locate paragraphs delimited by an empty line and 4 spaces:

  • To locate numbers in scientific notation; e.g., "-3.14 e -21":


<$exprs = "[^\alpha]\P=is" "here">
<$data = "This is a test." "This was also a test." "So there.">
<rex $exprs $data>

The return values in $ret would be "is" and "here".

The rex and split functions were added Oct. 14 1996. The looping syntax was added in version 2.6.938200000 19990924. At that time, both rex and split became binary compatible, i.e. varbyte data such as GIF images can be searched without truncation at nul values, and will return varbyte values. Note that $loop and $next are only set in the looping version, in syntax version 7.


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.