Community discussions

MikroTik App
 
runbound
Member Candidate
Member Candidate
Topic Author
Posts: 125
Joined: Fri Apr 19, 2013 9:28 am

how to get numbers in message

Sun Jul 03, 2022 10:14 am

i would like to get the numbers in message
like for example

eg1. message="hello ur acct# is 1234567890 hello
eg2 message="1234567890 hello hello"
eg3 message="hello hello 1234567890"
eg4 message="hello hello 1234567890 hello hello"

how do i get 10 digit number inside the message
pls help

:foreach i in=[/tool sms inbox find where phone="+6623423234"] do={
:local smsMessage [/tool sms inbox get $i message]
}
Last edited by runbound on Sun Jul 03, 2022 1:25 pm, edited 1 time in total.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: how to get numbers in message

Sun Jul 03, 2022 12:01 pm

Is it not in a more standard format?
It would help if you post more real example.

Not sure if there is a quick fix.
You can loop trough one and one character in the string, test if its a number, if yes, save it and start a counter.
If then 10 number are found one after one, then this is the phone number.

But if its on the same position in the text every time, its easy to get.

Number may be with or without country code, so no fixed length. What about number from not from your country?
 
runbound
Member Candidate
Member Candidate
Topic Author
Posts: 125
Joined: Fri Apr 19, 2013 9:28 am

Re: how to get numbers in message

Mon Jul 04, 2022 7:45 pm

hi sir this is not a cellphone number. this is a account number inside the text message

i need to get the 10digit number inside the text which is randomly sending my client because sometimes they include thier names before or after acct#
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: how to get numbers in message

Mon Jul 04, 2022 8:27 pm

Look at this post:
viewtopic.php?t=102375
It shows how to loop through a text string from start to end (len of string)

Then you need to make some logic to extract one and one number.
 
runbound
Member Candidate
Member Candidate
Topic Author
Posts: 125
Joined: Fri Apr 19, 2013 9:28 am

Re: how to get numbers in message  [SOLVED]

Tue Jul 05, 2022 5:26 pm

anyone can help me
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: how to get numbers in message

Tue Jul 05, 2022 7:42 pm

Can you read other users posts?
Is it not in a more standard format?
It would help if you post more real example.

Who is online

Users browsing this forum: No registered users and 14 guests