Hi friends,
Iβm having problem with running through a text file line by line to look for a string match using Regex and putting prefix and suffix strings on that matched value and save it again. Thank you in advance.
Hi friends,
Iβm having problem with running through a text file line by line to look for a string match using Regex and putting prefix and suffix strings on that matched value and save it again. Thank you in advance.
Hi @iamthejuan
Can you share some input example and the expected output for the same ??
so that it will be easy for us to give you perfect solution
Happy Automation
Best Regards
Er Pratik Wavhal
please share Sample data, expected output and description of the requirements with us
<Test>UiPath.Excel</Test>
<AssemblyReference>UiPath.System.Activities.Design</AssemblyReference>
<AssemblyReference>System.Collections.Immutable</AssemblyReference>
<AssemblyReference>System.ValueTuple</AssemblyReference>
<AssemblyReference>UiPath.DocumentUnderstanding.ML.Activities</AssemblyReference>
<AssemblyReference>UiPath.IntelligentOCR</AssemblyReference>
<Test>UiPath.Mail</Test>
<AssemblyReference>UiPath.OmniPage.Activities.Design</AssemblyReference>
<AssemblyReference>UiPath.CV</AssemblyReference>
<AssemblyReference>System.ServiceModel</AssemblyReference>
This is just a random string, in this example I want to add a parenthesis on the value between the and strings. In this examples the resulting string will become. Notice UiPath.Excel and UiPath.Mail is now enclosed with parenthesis.
<Test>(UiPath.Excel)</Test>
<AssemblyReference>UiPath.System.Activities.Design</AssemblyReference>
<AssemblyReference>System.Collections.Immutable</AssemblyReference>
<AssemblyReference>System.ValueTuple</AssemblyReference>
<AssemblyReference>UiPath.DocumentUnderstanding.ML.Activities</AssemblyReference>
<AssemblyReference>UiPath.IntelligentOCR</AssemblyReference>
<Test>(UiPath.Mail)</Test>
<AssemblyReference>UiPath.OmniPage.Activities.Design</AssemblyReference>
<AssemblyReference>UiPath.CV</AssemblyReference>
<AssemblyReference>System.ServiceModel</AssemblyReference>
Thank you for a quick response. @Pratik_Wavhal @ppr
Hi @iamthejuan
So as you provided the random string on that basis below regex will work :-
And then using Replace Activity of Regex you can add parenthesis to that Extracted string
Hope this will be the output you are expecting
Mark as solution and like it if this helps you
Happy Automation
Best Regards
Er Pratik Wavhal
@iamthejuan You can also give a Try on this :
System.Text.RegularExpressions.Regex.Replace(strInput,β(<Test>)(.*)(</Test>)β,β$1($2)$3β)
Where strInput is your Text Data and (<Test>)(.*)(</Test>) is the Pattern to be used, β$1($2)$3β This Performs a Replace based on the Groups Captured.
Hi @Pratik_Wavhal,
Thank you for the help, I was able to do your recommendation but for unknown reason it wonβt save the string within the for loop activity. I will be creating another topic for that. Thank you for your help @Pratik_Wavhal.
Thank you @supermanPunch, this works for me as Iβm having issues using for loop.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.