Good afternoon.
I am working on Power Automate and I would like to create a compose action that extract a specific data from a .txt file (Mail1.txt). I would like to extract the number which is located after Service and before the currency. In the example, this is 96 140. But for other example, the number will change.
color:black">The third PR 10303445 contains now only GBP. and is validated on SAP.</span></p><p style="direction:ltr; margin:0cm; font-family:Calibri,sans-serif; font-size:11pt"><span style="font-family:Aptos,sans-serif; color:black"> </span></p><ul style="direction:ltr; margin-top:0cm; margin-bottom:0cm"><li style="font-family:Calibri,sans-serif; font-size:11pt; color:black; direction:ltr; margin:0cm"><u>2023 TAS 167 Static Equipment & Package Engineer, PR </u><b><u>10303445</u></b><u>, PO 4100004319, (Consultant ).</u></li></ul><p style="direction:ltr; margin-top:0px; margin-bottom:0px; margin-left:36pt"><span style="font-family:"Segoe UI",sans-serif; font-size:12pt; color:black"> </span></p><p style="direction:ltr; margin-top:0px; margin-bottom:0px; margin-left:36pt"><span style="font-family:"Segoe UI",sans-serif; font-size:12pt; color:black">Line 3, 4000657 Service : <b>96 140</b> <b>GBP</b></span></p><p style="direction:ltr; margin-top:0px; margin-v></body></html>
Thank you for your help.
I tried this in the input from PowerAutomate.
substring( string(outputs('Compose_1_extraire_contenu_du_fichier')), add(indexOf(string(outputs('Compose_1_extraire_contenu_du_fichier')), 'Service: '), 9), sub( indexOf( string(outputs('Compose_1_extraire_contenu_du_fichier')), ' ', add(indexOf(string(outputs('Compose_1_extraire_contenu_du_fichier')), 'Service: '), 9) ), add(indexOf(string(outputs('Compose_1_extraire_contenu_du_fichier')), 'Service: '), 9) ) )
I get the following error:
There'll be better ways to do this with regex but I've managed to get by using a standard expression based on the text you provided.
This is the expression I used ...
last(split(first(split(last(split(outputs('Compose_Email'), 'Service :')), '</b>')), '<b>'))