The prxmatch function

Reply
Contributor
Posts: 42

The prxmatch function

Hi All,

 

I have been struggling to use the prxmatch function to validate email addresses. Can anyone direct me to a resource to use please?

 

THanks

Super User
Posts: 23,663

Re: The prxmatch function

In general, you'll find macros and examples most easily on LexJansen.com

 

https://lexjansen.com/search/searchresults.php?q=prx%20email%20addresses

 

 

PROC Star
Posts: 2,326

Re: The prxmatch function

prxmatch uses Perl regular expressions (except for the more arcane expressions), so most examples on the web can be used in prxmatch.

 

Here is a simple one.

 

data TEST;
  input EMAIL :$60.;  
  IS_VALID=prxmatch('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}$/i',strip(EMAIL));
cards;       
robot@sas.com            
james.taylor@sas.co.nz
james@taylor@sas.co.nz
run;
IS_VALID
1
1
0
Valued Guide
Posts: 557

Re: The prxmatch function

There is a discussion on stackoverflow: https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expressi... about validating e-mail addresses. If your code needs to be 100% RFC822 compliant, the expression is a bit more complex ;-)

Ask a Question
Discussion stats
  • 3 replies
  • 115 views
  • 1 like
  • 4 in conversation