Hello,
Using UiPath I need to extract the name of all users from between the text - each user must be assigned in a separate column in DataTable. The number of users varies - there may be one or a dozen. Below is an example of text that I can extract from the application:
“Select the right Service: Project CreationEnter Project Administrator: User1Enter Project Administrator: User2Enter Project Administrator: User3Enter Project Category: None”
I need to extract all project administrators into DataTable:
|Column 1|
|User1|
|User2|
|User3|
The number of users may vary. Then the text will look like this.
“Select the right Service: Project CreationEnter Project Administrator: User1Enter Project Category: None”
Then i need to extract only “User1” to DT.
Could you please help?
Best Regards,
Damian
Initialize a variable named inputText to store the text you want to extract from.
Initialize a DataTable variable named userDataTable to store the extracted user names.
Use Matches Activity:
Use the Matches activity to extract all occurrences of user names from the input text using a regular expression pattern.
The regular expression pattern should capture the text after “Enter Project Administrator:” and before the next occurrence of “Enter Project” or the end of the text.
Process Matches:
Iterate through the matches obtained from the Matches activity.
Add each match to the Data Table as a new row.
Please let me know if my suggestion resolves your issue.
Thank you for your answer!
I was able to extract this data using Find Matching patterns activity.
But I’m totally lost on point 3. I don’t know what exactly I should do
How to make it so that in DT there is only a username in each row.
Hi @vrdabberu,
Thank you very much. One question- What if different values are substituted under “User1”, “User2”, etc. - e-mail or account name, e.g. damian.test@gmail.com or DamianTEST.
Instead of the word “User1” there can be any possible string of characters and special characters.
Best Regards,
Damian
You can use this regex: (?<=Project Administrator: )(.*?)(?=Enter|$)
It will fetch all the mentioned possibilities from your string as you can see in below screenshot!