Hi @arivu96,
I don’t want to split my regular expressions.
Thanks,
Vinath
As you said multiple regular expression will be there in one notepad and need to apply that expression into another text file.
But with out Loop how you ll execute all the regular expression???
If it is a single expression you can directly apply
Regards,
Arivu
Hi @arivu96,
Can you please send the sample xaml file to loop the regular expression.
Thanks,
Vinath.
Hi @vinathkumar,
1.Read the Text File using Read Text File Activity and store it in strExpression(string variable)
2.Read the another Text File using Read Text File Activity and store it in strText(string variable)
3.create arrvar(String variable)
4.using Assign Activity arrvar=strExpression.Split(Environment.NewLine.ToArray)
5. using For Each activity loop through it.
6. Inside for each body assign the Regular Expression and get the value from the strText
For reference
https://activities.uipath.com/docs/string-is-match
https://activities.uipath.com/docs/string-matches
Regards,
Arivu
Hi @arivu96,
I am unable to write the out put to a text file i am attaching my work flow please check it.Regex.zip (40.7 KB)
Hi @vinathkumar,
“Forn 1040 (([0-9]{4}))”
“Farm 1040 (([0-9]{4}))”
“Form 1040 (([0-9]{4}))”
This is the correct format
(Form 1040 ([0-9]{4}))
(Farm 1040 ([0-9]{4}))
(Form 1040 ([0-9]{4}))
can you check regarding this.
And Also Matches activity stored in Variable1
After Matches in the for loop you need to store the result in some variable
Regards,
Arivu
I have moved this post into the #rpa-dev:rookies category as it is not a question about Orchestrator. Also, please ask questions only once. I responded to the same question in a different thread yesterday:
Hi @arivu96,
After making changes as per the above you mentioned also i am unable to write the out put into the text file
Thanks
Vinath
Hi @vinathkumar,
format changed while paste , Please use above one.
(Form 1040 \([0-9]{4}\))
(Farm 1040 \([0-9]{4}\))
(Form 1040 \([0-9]{4}\))
Read Regex Text file store it into ->strRegex
Read Input Text file store it into ->strInput
create string ->arrvalue
arrvalue= strRegex.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
create IEnum (variable type IEnumerable)
For loop arrvalue
use Matches activity pass input->strInput and Pattern->item and output->IEnum
use another foreach IEnum to get all the matching data store it into list/Stringbuilder
Finally store the output into Text file.
Regards,
Arivu
HI @vinathkumar,
Please refer this xaml File.
Main.xaml (11.2 KB)
Regex text file
(Form 1040 \([0-9]{4}\))
(Farm 1040 \([0-9]{4}\))
(Form 1040 \([0-9]{4}\))
Regards,
Arivu
Hi @arivu96,
I have another query can you please help on this
How to search a specific word in a text file and display a word with corresponding line number.
Thanks,
Vinath.
Hi @vinathkumar,
I have one idea.
using Read Text File read the text and store it in string variable.
using Environment.NewLine split the string to list.
check the string is available in the list using contains function and get the index also.
The Index is the line number of the text in the text file.
Regards,
Arivu
Hi @arivu96,
I have did all the above things before and thank you for suggesting can you tell me the activity/function used to get index
Thanks
Vinath
Hi @vinathkumar,
i think you can achieve from LINQ.
else
create intIndex int variable
use for loop the array and in if condition check contains the string get the index position
by increasing the intIndex value in loop
Regards,
Arivu
Hi @arivu96,
This is the work flow i have created. Is there any mistake in that. Please rectify if it is any mistake.
.Main.xaml (7.5 KB)
Thanks,
Vinath
Hi,
Be advised that these three patterns can be combined into a single one, in various ways:
Forn|Farm|Form 1040 ([0-9]{4})
F[oa]r[mn] 1040 ([0-9]{4})
This last form matches the additional spelling “Farn” not included in your list.
Hi,
I have total of 3 different Regex patterns, is it possible to make a regex engine comprising of all the three patterns?
what i am currently doing is, my pdf text is passing through first pattern, if the count is returning 0, it goes through second pattern and so on.
Is it possible that the pdf text extracted passes through all the 3 patterns at once??
Hi,
Something like “(pattern1)|(pattern2)|(pattern3)”?