BookmarkSubscribeRSS Feed
frupaul
Quartz | Level 8

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

3 REPLIES 3
Reeza
Super User

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

 

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

 

 

ChrisNZ
Tourmaline | Level 20

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
andreas_lds
Jade | Level 19

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 😉

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 418 views
  • 1 like
  • 4 in conversation