Perl Version Notes - Introduction to Regular Expressions in SAS (2014)

Introduction to Regular Expressions in SAS (2014)

Appendix A. Perl Version Notes

This appendix contains notes about the limitations of the Perl version that is used by SAS 9.41. It is intended for the Perl experts out there who are wondering about some of the missing pieces within SAS. The information below was taken directly from the SAS website and is provided here because it is somewhat difficult information to find but is potentially very useful to the advanced reader of this book.

“The PRX functions use a modified version of Perl 5.6.1 to perform regular expression compilation and matching. Perl is compiled into a library for use with SAS. This library is shipped with SAS® 9. The modified and original Perl 5.6.1 files are freely available in a ZIP file from the Technical Support Web site. The ZIP file is provided to comply with the Perl Artistic License and is not required in order to use the PRX functions. Each of the modified files has a comment block at the top of the file describing how and when the file was changed. The executables were given nonstandard Perl names. The standard version of Perl can be obtained from the Perl Web site.

Only Perl regular expressions are accessible from the PRX functions. Other parts of the Perl language are not accessible. The modified version of Perl [RegEx] does not support the following items:”2

• All Perl variables, except for the capture buffer variables $1 - $n

• Metacharacters \G, \pP, \PP, and \X

• RegEx options /c and /g, and /e with substitutions

• Named characters (i.e., \N{name})

• Executing Perl code within a regular expression, which includes the syntax (?{code}), (??{code}), and (?p{code})

• Unicode pattern matching

• Pattern delimiters other than the backslash. For example: ?PATTERN?, !PATTERN!, etc.

• Perl code comments between a pattern and replacement text. For example: s{regexp} #perl comment {replacement text}

• Using matching backslashes with m/\\\\/ instead of m/\\/ to match a backslash

1 The available Perl RegEx functionality has not changed since SAS 9.1. These notes are current as of the writing of this book. For the most up-to-date information regarding versioning, please visit the SAS documentation website at: http://support.sas.com/documentation/

2http://support.sas.com/documentation/cdl/en/lefunctionsref/67239/HTML/
default/viewer.htm#p0tw80fkqqpow5n1f7xwvd6bsonq.htm