- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm looking to extract IBAN numbers from some SWIFT data I have, but my PRXMATCH function doesn't seem to be working, does anyone know why?
An example of the text field I'm searching in would be:
LV05AIZK1234567891234 COMPANY NAME ADDRESS
In order to find the starting character for the match to use in a substring extract, I'm using:
PRXMATCH('/\LV\d{2}\D{4}\d{13}\s/', COLUMN)
This looks right to me but I keep getting a result of zero where I can see this IBAN form in the data.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This seemes to work 🙂
data one;
length iban $32 column $200;
column = 'One IBAN Number: LV05AIZK1234567891234 COMPANY NAME ADDRESS';
pos = PRXMATCH('/LV\d{2}\D{4}\d{13}/', COLUMN);
run;
I removed the first \ and the trailing \s.....
//Fredrik
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Would not scan(string,1," ") not work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That's a much neater solution for this particular problem thanks. For instances where the IBAN can potentially be anywhere in the string, can you think what's wrong the the PRXPARSE statement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, I am not familiar with Perl so much, so will let others comment on that. If it always starts with "LV" and length 21 which your regex seems to indicate then:
want=substr(thestring,index(thestring,"LV"),21);
So find LV in the string, and then substr out 21 characters from there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perfect, thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This seemes to work 🙂
data one;
length iban $32 column $200;
column = 'One IBAN Number: LV05AIZK1234567891234 COMPANY NAME ADDRESS';
pos = PRXMATCH('/LV\d{2}\D{4}\d{13}/', COLUMN);
run;
I removed the first \ and the trailing \s.....
//Fredrik
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this works now thanks