Hi people, I’m trying to extract a string from another string stored in a variable using regex but it shows no value. The regular expression seems to be correct.
Could you tell me what I’m doing wrong?
This is the text file content:
GA_AABOGSM8sid_limiteConsumo01
GA_AABOGSM8sid_umbralLimiteC01
GA_AABOGSM8sid_eventosLimite01
GA_AABOGSM8sflg_eventoLimite01
GA_AABOGSM8sflg_eventoUmbral01
GA_AABOGSM8sflg_eventoLimCon01
GA_AABOGSM8sflg_eventoUmbCon01
GA_AABOGSM8sflg_tasarAdicion01
RTN pkt(1) is :
rpr_srv_version 1
rpr_srv_flags 0
GA_AABOGSM8__rpr_ret 0
rpr_srv_name GA_AABOGSM8
GA_AABOGSM8_sSecActuacion 52798386548
[PREPO E6 arppga@mvlzffesg1]: Cert > exit
Last login: Thu Jun 8 11:28:54 2023 from 10.9.37.167
I describe the steps:
1- I read from a txt file using “Read text file” activity.
2- With an “assign” activity I extract some part of the string using regex and I store it in “portapapeles2” variable.
System.Text.RegularExpressions.Regex.Match(portapapeles,“((?<=GA_AABOGSM8_sSecActuacion)\s.*)”).Value
Result: " 52798386548"
3- I check with a “message box” activity if it captures the string I want. It does.
4- With an “Assign” activity I try to extract a string with a regex and store it in “portapapeles 3”. But this seems not to work.
System.Text.RegularExpressions.Regex.Match(portapapeles2,“\S\d*$”).Value
Result: “”
5- Message box “portapapeles3” shows no value.
What I want to achieve in the second assign is to select only the numbers and remove the whitespaces. The regex works in .NET Regex Tester - Regex Storm
Thanks in advance!
Juan