mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 1:34pm
1
Hi guys!
I created a RegEx to extract text between characters, I tested it on regex101.com platform and works well, but on UiPath it just doesn’t work.
Text example:
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">False</Column>
I want extract the word False, the regex that I created it’s this one:
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">([^><]*)
Someone can help?
Thanks
Yoichi
(Yoichi)
September 11, 2020, 1:40pm
2
Hi,
regex101 is not 100% compatible with .net regex.
Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(text,"(?<=<Column XPath=""m_LTP_TransfPropriedade.brevendedor"" Name=""E_M_LTP_TRANSFPR_BREVENDED"">).*?(?=<)").Value
Regards,
1 Like
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:01pm
3
Hi, thanks for your help, I tried it but isn’t working
Yoichi
(Yoichi)
September 11, 2020, 2:08pm
4
Hi,
Can you check following sample? Probably there are difference between your string data and sample’s one.
Sequence1.xaml (5.3 KB)
Regards,
1 Like
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:15pm
5
Yes you’re samples works well @Yoichi , my string data contains more text,more lines, maybe it’s that, I just don’t past here because it’s to much text, can I send to you to see if we can put it working, if you don’t mind?
Regards,
Yoichi
(Yoichi)
September 11, 2020, 2:21pm
6
Hi,
No, I don’t mind. I can check your data if you send me or share with us.
Regards,
1 Like
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:26pm
7
Thanks!
I will paste here then
<?xml version="1.0"?>
-<BizAgiWSResponse>
-<Results>
<RowsCount>2</RowsCount>
<PageCount>1</PageCount>
-<Tables>
-<CaseTable>
-<Columns>
<Column Type="String" XPath="RADNUMBER" DisplayName="RADNUMBER" Name="RADNUMBER"/>
<Column Type="String" XPath="WFCLSDISPLAYNAME" DisplayName="WFCLSDISPLAYNAME" Name="WFCLSDISPLAYNAME"/>
<Column Type="DateTime" XPath="CASCREATIONDATE" DisplayName="CASCREATIONDATE" Name="CASCREATIONDATE"/>
<Column Type="DateTime" XPath="CASSOLUTIONDATE" DisplayName="CASSOLUTIONDATE" Name="CASSOLUTIONDATE"/>
<Column Type="String" XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido" DisplayName="idp_LTP_tipodepedido" Name="E_P_LTP_TIPODEPED_SDESCRIC"/>
<Column Type="String" XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso" DisplayName="idp_LTP_estadoprocesso" Name="E_P_LTP_ESTADOPRO_SDESCRIC"/>
<Column Type="Boolean" XPath="m_LTP_TransfPropriedade.badvogado" DisplayName="badvogado" Name="E_M_LTP_TRANSFPROP_BADVOGA"/>
<Column Type="Boolean" XPath="m_LTP_TransfPropriedade.brevendedor" DisplayName="brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED"/>
<Column Type="Boolean" XPath="m_LTP_TransfPropriedade.baprovacaoonline" DisplayName="baprovacaoonline" Name="E_M_LTP_TRAN_BAPROVACAOONL"/>
<Column Type="Boolean" XPath="m_LTP_TransfPropriedade.bisentopagamento" DisplayName="bisentopagamento" Name="E_M_LTP_TRAN_BISENTOPAGAME"/>
<Column Type="Integer" XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitoativo.inif" DisplayName="inif" Name="E_M_LTP_INTERVENIENTES_INI"/>
<Column Type="Integer" XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitopassivo.inif" DisplayName="inif" Name="E_M_LTP_INTERVENIENTES0_IN"/>
<Column Type="Guid" XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido.guid" DisplayName="E_P_LTP_TIPO_GUIDP_LTP_TIP" Name="E_P_LTP_TIPO_GUIDP_LTP_TIP"/>
<Column Type="Guid" XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso.guid" DisplayName="E_P_LTP_ESTA_GUIDP_LTP_EST" Name="E_P_LTP_ESTA_GUIDP_LTP_EST"/>
<Column Type="Integer" XPath="IDPARENTCASE" DisplayName="IDPARENTCASE" Name="IDPARENTCASE"/>
<Column Type="Guid" XPath="GUIDADHOCPROCESS" DisplayName="GUIDADHOCPROCESS" Name="GUIDADHOCPROCESS"/>
<Column Type="Guid" XPath="IDPLAN" DisplayName="IDPLAN" Name="IDPLAN"/>
<Column Type="String" XPath="PLANNAME" DisplayName="PLANNAME" Name="PLANNAME"/>
<Column Type="Guid" XPath="GUIDWFCLASS" DisplayName="GUIDWFCLASS" Name="GUIDWFCLASS"/>
<Column Type="Integer" XPath="IDWFCLASS" DisplayName="IDWFCLASS" Name="IDWFCLASS"/>
<Column Type="String" XPath="ANCESTORPATH" DisplayName="ANCESTORPATH" Name="ANCESTORPATH"/>
<Column Type="Integer" XPath="IDWORKFLOW" DisplayName="IDWORKFLOW" Name="IDWORKFLOW"/>
<Column Type="Integer" XPath="CASEPATH" DisplayName="CASEPATH" Name="CASEPATH"/>
<Column Type="Decimal" XPath="AMOUNT" DisplayName="AMOUNT" Name="AMOUNT"/>
<Column Type="Guid" XPath="CASEGUID" DisplayName="CASEGUID" Name="CASEGUID"/>
<Column Type="Integer" XPath="IDCASE" DisplayName="IDCASE" Name="IDCASE"/>
<Column Type="Integer" XPath="IDCASESTATE" DisplayName="IDCASESTATE" Name="IDCASESTATE"/>
<Column Type="Integer" XPath="CASECLOSED" DisplayName="CASECLOSED" Name="CASECLOSED"/>
<Column Type="BigInt" XPath="ROWNUMBERBIZAGI" DisplayName="ROWNUMBERBIZAGI" Name="ROWNUMBERBIZAGI"/>
</Columns>
-<Rows>
-<Row Id="0">
<Column Name="RADNUMBER">1051</Column>
<Column Name="WFCLSDISPLAYNAME">Transferencia de Propriedade</Column>
<Column Name="CASCREATIONDATE">2020-09-08T09:21:14</Column>
<Column Name="CASSOLUTIONDATE">2020-09-22T09:21:14</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido" Name="E_P_LTP_TIPODEPED_SDESCRIC">Venda</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso" Name="E_P_LTP_ESTADOPRO_SDESCRIC">Para Registo Online</Column>
<Column XPath="m_LTP_TransfPropriedade.badvogado" Name="E_M_LTP_TRANSFPROP_BADVOGA">True</Column>
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">False</Column>
<Column XPath="m_LTP_TransfPropriedade.baprovacaoonline" Name="E_M_LTP_TRAN_BAPROVACAOONL">False</Column>
<Column XPath="m_LTP_TransfPropriedade.bisentopagamento" Name="E_M_LTP_TRAN_BISENTOPAGAME">False</Column>
<Column XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitoativo.inif" Name="E_M_LTP_INTERVENIENTES_INI">1</Column>
<Column XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitopassivo.inif" Name="E_M_LTP_INTERVENIENTES0_IN">1</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido.guid" Name="E_P_LTP_TIPO_GUIDP_LTP_TIP">e581570a-cfb1-4b42-bc51-0cb52acf7342</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso.guid" Name="E_P_LTP_ESTA_GUIDP_LTP_EST">3a04ff5f-85e9-447c-874a-641d63f773a3</Column>
<Column Name="IDPARENTCASE"/>
<Column Name="GUIDADHOCPROCESS"/>
<Column Name="IDPLAN"/>
<Column Name="PLANNAME"/>
<Column Name="GUIDWFCLASS">f06b7eca-baaa-4db0-b61e-478140e81bca</Column>
<Column Name="IDWFCLASS">134</Column>
<Column Name="ANCESTORPATH">134</Column>
<Column Name="IDWORKFLOW">314</Column>
<Column Name="CASEPATH"/>
<Column Name="AMOUNT">0.0000</Column>
<Column Name="CASEGUID">3b1380c2-3300-4fdf-b367-efdc84c1429c</Column>
<Column Name="IDCASE">1051</Column>
<Column Name="IDCASESTATE">2</Column>
<Column Name="CASECLOSED">0</Column>
<Column Name="ROWNUMBERBIZAGI">1</Column>
</Row>
-<Row Id="1">
<Column Name="RADNUMBER">1101</Column>
<Column Name="WFCLSDISPLAYNAME">Transferencia de Propriedade</Column>
<Column Name="CASCREATIONDATE">2020-09-10T13:52:09</Column>
<Column Name="CASSOLUTIONDATE">2020-09-24T14:00:09</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido" Name="E_P_LTP_TIPODEPED_SDESCRIC">Compra</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso" Name="E_P_LTP_ESTADOPRO_SDESCRIC">Para Registo Online</Column>
<Column XPath="m_LTP_TransfPropriedade.badvogado" Name="E_M_LTP_TRANSFPROP_BADVOGA">True</Column>
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">False</Column>
<Column XPath="m_LTP_TransfPropriedade.baprovacaoonline" Name="E_M_LTP_TRAN_BAPROVACAOONL">False</Column>
<Column XPath="m_LTP_TransfPropriedade.bisentopagamento" Name="E_M_LTP_TRAN_BISENTOPAGAME">False</Column>
<Column XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitoativo.inif" Name="E_M_LTP_INTERVENIENTES_INI">123456789</Column>
<Column XPath="m_LTP_TransfPropriedade.idm_LTP_sujeitopassivo.inif" Name="E_M_LTP_INTERVENIENTES0_IN">123456789</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_tipodepedido.guid" Name="E_P_LTP_TIPO_GUIDP_LTP_TIP">70f0faac-cc35-4d0d-a747-c68b6baf4dc9</Column>
<Column XPath="m_LTP_TransfPropriedade.idp_LTP_estadoprocesso.guid" Name="E_P_LTP_ESTA_GUIDP_LTP_EST">3a04ff5f-85e9-447c-874a-641d63f773a3</Column>
<Column Name="IDPARENTCASE"/>
<Column Name="GUIDADHOCPROCESS"/>
<Column Name="IDPLAN"/>
<Column Name="PLANNAME"/>
<Column Name="GUIDWFCLASS">f06b7eca-baaa-4db0-b61e-478140e81bca</Column>
<Column Name="IDWFCLASS">134</Column>
<Column Name="ANCESTORPATH">134</Column>
<Column Name="IDWORKFLOW">314</Column>
<Column Name="CASEPATH"/>
<Column Name="AMOUNT">0.0000</Column>
<Column Name="CASEGUID">fa006a7f-72b0-4fa5-8b5b-fe3754d06dd7</Column>
<Column Name="IDCASE">1101</Column>
<Column Name="IDCASESTATE">2</Column>
<Column Name="CASECLOSED">0</Column>
<Column Name="ROWNUMBERBIZAGI">2</Column>
</Row>
</Rows>
</CaseTable>
-<TaskTable>
-<Columns>
<Column Type="DateTime" XPath="TaskState" DisplayName="TaskState" Name="TaskState"/>
<Column Type="String" XPath="CurrentTask" DisplayName="CurrentTask" Name="CurrentTask"/>
<Column Type="DateTime" XPath="wiEstimatedSolutionDate" DisplayName="wiEstimatedSolutionDate" Name="wiEstimatedSolutionDate"/>
<Column Type="Guid" XPath="guidAdhocTask" DisplayName="guidAdhocTask" Name="guidAdhocTask"/>
<Column Type="Guid" XPath="guidTask" DisplayName="guidTask" Name="guidTask"/>
<Column Type="Integer" XPath="idTaskType" DisplayName="idTaskType" Name="idTaskType"/>
<Column Type="Integer" XPath="idTask" DisplayName="idTask" Name="idTask"/>
<Column Type="Integer" XPath="idWorkItem" DisplayName="idWorkItem" Name="idWorkItem"/>
<Column Type="Guid" XPath="CaseGUID" DisplayName="CaseGUID" Name="CaseGUID"/>
<Column Type="Integer" XPath="idCase" DisplayName="idCase" Name="idCase"/>
<Column Type="Guid" XPath="guidActivityPlan" DisplayName="guidActivityPlan" Name="guidActivityPlan"/>
<Column Type="String" XPath="activityPlanName" DisplayName="activityPlanName" Name="activityPlanName"/>
</Columns>
-<Rows>
-<Row Id="0">
<Column Name="TaskState">2020-09-14T09:24:49</Column>
<Column Name="CurrentTask">Completar pedido Registo Online</Column>
<Column Name="wiEstimatedSolutionDate">2020-09-14T09:24:49</Column>
<Column Name="guidAdhocTask"/>
<Column Name="guidTask">3b16b0bd-d64f-400d-900f-955f59e89b14</Column>
<Column Name="idTaskType">2</Column>
<Column Name="idTask">2921</Column>
<Column Name="idWorkItem">2024</Column>
<Column Name="CaseGUID">3b1380c2-3300-4fdf-b367-efdc84c1429c</Column>
<Column Name="idCase">1051</Column>
<Column Name="guidActivityPlan"/>
<Column Name="activityPlanName"/>
</Row>
-<Row Id="1">
<Column Name="TaskState">2020-09-16T14:00:27</Column>
<Column Name="CurrentTask">Completar pedido Registo Online</Column>
<Column Name="wiEstimatedSolutionDate">2020-09-16T14:00:27</Column>
<Column Name="guidAdhocTask"/>
<Column Name="guidTask">3b16b0bd-d64f-400d-900f-955f59e89b14</Column>
<Column Name="idTaskType">2</Column>
<Column Name="idTask">2921</Column>
<Column Name="idWorkItem">2074</Column>
<Column Name="CaseGUID">fa006a7f-72b0-4fa5-8b5b-fe3754d06dd7</Column>
<Column Name="idCase">1101</Column>
<Column Name="guidActivityPlan"/>
<Column Name="activityPlanName"/>
</Row>
-<Row Id="2">
<Column Name="TaskState">9999-12-31T23:59:59</Column>
<Column Name="CurrentTask">Cancelar processo</Column>
<Column Name="wiEstimatedSolutionDate">9999-12-31T23:59:59</Column>
<Column Name="guidAdhocTask"/>
<Column Name="guidTask">b95268b5-661a-4e97-88aa-b4dbb8c5d726</Column>
<Column Name="idTaskType">12</Column>
<Column Name="idTask">2907</Column>
<Column Name="idWorkItem">2060</Column>
<Column Name="CaseGUID">fa006a7f-72b0-4fa5-8b5b-fe3754d06dd7</Column>
<Column Name="idCase">1101</Column>
<Column Name="guidActivityPlan"/>
<Column Name="activityPlanName"/>
</Row>
</Rows>
</TaskTable>
</Tables>
</Results>
-<Parameters>
<Parameter Name="PageSize">10</Parameter>
<Parameter Name="idEnt">10662</Parameter>
<Parameter Name="page">1</Parameter>
</Parameters>
</BizAgiWSResponse>
RoboHeart
(RoboHeart)
September 11, 2020, 2:29pm
8
Trouble could come from the quotation marks.
Probably you just need no double ""
1 Like
Yoichi
(Yoichi)
September 11, 2020, 2:32pm
9
Hi,
Thank you for sharing.
However it works with same expression in my environment. Can you check the following sample?
Sequence1.xaml (4.8 KB)
test.txt (10.7 KB)
Regards,
1 Like
RoboHeart
(RoboHeart)
September 11, 2020, 2:35pm
10
I see…
@Yoichi is using the direct function.
I used the activity.
What are you using?
1 Like
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:36pm
11
Yes your sample works well!!! But if I try your sample with my .txt file, it doesnt work
My original file it’s this one
filteredCases.txt (10.2 KB)
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:38pm
12
I tried the first @Yoichi sample with my .txt file, and the last one to
RoboHeart
(RoboHeart)
September 11, 2020, 2:40pm
13
maybe there is nothing in it what matches the pattern
…mom
RoboHeart
(RoboHeart)
September 11, 2020, 2:41pm
14
nope…cannot find something
Yoichi
(Yoichi)
September 11, 2020, 2:46pm
15
Hi,
Your original data (in filteredCases.txt) is the following.
<Column Name="E_M_LTP_TRANSFPR_BREVENDED" XPath="m_LTP_TransfPropriedade.brevendedor">
However your 1st post data is
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">False</Column>
So there are difference position bw XPath and Name. (Probably it’s caused by XML parser)
Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(text,"(?<=<Column Name=""E_M_LTP_TRANSFPR_BREVENDED"" XPath=""m_LTP_TransfPropriedade.brevendedor"">).*?(?=<)").Value
Sequence1.xaml (5.3 KB)
Regards,
2 Likes
RoboHeart
(RoboHeart)
September 11, 2020, 2:47pm
16
the order is different
<Column Name="E_M_LTP_TRANSFPR_BREVENDED" XPath="m_LTP_TransfPropriedade.brevendedor">
vs.
<Column XPath="m_LTP_TransfPropriedade.brevendedor" Name="E_M_LTP_TRANSFPR_BREVENDED">
That is the reason
1 Like
mmcruzRPA
(Marcelo Cruz)
September 11, 2020, 2:50pm
17
Yes, you have reason, I didn’t notice that, my fault, thank you very much guys!
1 Like
system
(system)
Closed
September 14, 2020, 2:51pm
19
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.