Extract Text & number from message

Macro_Mitch

New member
Hi. I'm trying to design a macro which can extract account details and phone number from specific message received. Here is an example
QE950Q84KD Confirmed, on 9/5/22 at 8:23 AM Ksh250.00 received from ANN MUTHONI NJENGA 254722892403, Account Number roysambu New Utility balance is Ksh15,850.00
In above example, roysambu is account details, and 254722892403 is phone number. The two are different in every message as shown in picture. Thanks in advance.Screenshot_20220509-093224.png
 

RSF

Well-known member
Use MacroDroid's Text Manipulation > Extract Text feature:
  1. Get the message text into a variable, probably using MacroDroid's Notification Received trigger. (In the screenshot below I just manually set a variable called "msg" for testing)
  2. Extract each element from the notification with a separate Text Manipulation action with the Extract Text option. Within that, use the "Group 1" option and a regular expression as shown in the screenshot (note that the regular expression shouldn't have the surrounding parentheses shown in the screenshot; MacroDroid adds them when it displays the summary of the action in the macro display. For example, the first regular expression below should be \d{5,99})\.
Screenshot_20220509-085525.png

Results:
Screenshot_20220509-090455.png
 

Macro_Mitch

New member
Your example works fine. How can i correct this regex to extract amount paid which in 3xample below is 300.00, but without the decimal part

QEA7QNJSPB Confirmed. on 10/5/22 at 7:47 AM Ksh300.00 received from FRANCIS MWANGI 254724220855. Account Number spur mall, Kimbo New Utility balance is Ksh23,500.00
 

Dm114

Well-known member
Your example works fine. How can i correct this regex to extract amount paid which in 3xample below is 300.00, but without the decimal part

QEA7QNJSPB Confirmed. on 10/5/22 at 7:47 AM Ksh300.00 received from FRANCIS MWANGI 254724220855. Account Number spur mall, Kimbo New Utility balance is Ksh23,500.00
Same text manipulation as @RSF has shown with regex like this: Ksh(\d+)\.d{2} received
 

Ashu

New member
i have a text message " from: place 1 , to: place 2" how can i extract text after from: and to: and i want to use it in goggle map 'from' and 'to' place
 

Ashu

New member
Your example works fine. How can i correct this regex to extract amount paid which in 3xample below is 300.00, but without the decimal part

QEA7QNJSPB Confirmed. on 10/5/22 at 7:47 AM Ksh300.00 received from FRANCIS MWANGI 254724220855. Account Number spur mall, Kimbo New Utility balance is Ksh23,500.00
what you wrote to extract text
 

RSF

Well-known member
Use the Text Manipulation action, with Extract Text and Group 1 options, and regular expressions from (.*), to .* and from .*, to (.*)

1715607015089.png
 
Top