I want to extract 2 string of numbers from an sms, for example.
"0123456789 JANE 50"
"0123456789" is called the MSISDN
"50" is called AMOUNT, may vary from 1-100.
I learnt how to extract MSISDN but i can't figure out how to extract AMOUNT.
Any help is greatly appreciated, Martin. Thanks!
Copy the last 2-3 digits in an sms.
Moderator: Martin
Re: Copy the last 2-3 digits in an sms.
You can use a regex to extract the 50:
Regards,
Martin
Code: Select all
sms_text = "0123456789 JANE 50";
groups = newList();
matches(sms_text, '.*\\s(\\d+).*', groups);
amount = groups[1];
Martin