Learning SAS's Perl Regular Expression Matching the Easy Way: By Doing
SCHOOL OF AEROSPACE MEDICINE WRIGHT-PATTERSON AFB OH AEROMEDICAL RESEARCH DEPT
Pagination or Media Count:
Perl Regular Expression PRX functions were added in SAS9. The key to learning how to use them is learning PRX metacharacter behavior within a PRX match. The more you practice PRX matching, the more proficient you become. Ideally, practice would involve a method for repeating the matching process so as to see cause and effect between the input, in the form of modifications to the perl regular expression andor the source string, and the output in the form of the match results. But just as important as the practice itself would be a method for logging your practice trail in a file for future reference and expansion as well as avoidance of wheel-reinventing. But how do you do this without this file becoming bloated, cluttered, and unmanageable The answer is to let it become bloated and cluttered. Enter the regexlearningtool consisting of a SAS Enterprise Guide project and an Excel file containing your practice trail in the form of match records each with a different perl regular expression andor source string. The regexlearningtool allows both beginner and expert to efficiently practice PRX matching by selecting and processing only the match records that the user is interested in based on a search of either PRX metacharacters contained in the perl regular expression or character strings contained in a match description field. The current Excel file contains over 400 match records demonstrating the use of most all PRX metacharacters. This paper will explain how to use the regexlearningtool so that you can practice PRX matching, retain what you learn, and not have to worry about how bloated, cluttered, and unmanageable your practice trail becomes. The regexlearningtool project was written using SAS Enterprise Guide 5.1 and SAS 9.3 on a Windows 7 Enterprise operating system. A copy of the SAS Enterprise Guide project, Excel file, as well as other tool-related material can be found at sascommunity.org under Papers and Presentations.
- Computer Programming and Software