The way to eat an elephant is one bite at a time.
Don't run yourself into the ground trying to make one thing do everything.
test the pattern
test for multiple '@' separately
test for imbedded spaces separately.
As an example,
When I test a textually provided date, I have a sequence of steps
1) is it in a prescribed format, e.g. yyyy-mm-dd = '....-..-..'
In this case
2) are the fields numeric?
3) is 01 LE mm LE 12
4) is 01 LE dd LE 31
5) for a given month, is dd within that month's proper range -- jan LT 32, apr LT 31; I have already determined it is GT 0.
This simplifies the parsing, and improves my error responses to being more specific to what is wrong, as opposed to just "invalid date".
To count the number of '@' that exist in a string, use either the SAS count or countc functions.
You can use INDEX, INDEXC, COUNT, COUNTC or ANYSPACE to indentify spaces. ANYSPACE identifies white space -- tab, space, carriage return.
Message was edited by: Chuck