Extract text from Text file using Substring

Correct,
Cheers
Happy Learning
@Pavan_Srikar

@Pradeep_Shiv Thanks for the ton for the above Regex samples, understood it quickly and tried using it for the rest of my fields and all worked fine except a few.

1 Like

Great,
Let me know, if you still face any issues

Sure, one issue my text file has values that are a combination of two variables. VarA + VarB

My file looks like something below.

Here I am trying to get a driver’s license, but It has a continuation of one more header which is the start of the second variable value .

Name: Mirta Rodriguez
Address: 9 FLORENTIA ST
GLENFIELD NSW2167
ABN: 79910196785
Mobile No: 0413406671
Personal Email: mrcoaching26@gmail.com
Date of Birth: 16/10/1962
Driver’s Licence: 3184dsAccount No: 13287726
Introducing Dealer: Peter WarTen Toyota
Type: Toyota Access Business Vehicle Loan
Payment Required: $1,245.50
Contract Inception Date: 24 December 2018
Date Last Paid: 1 July 2020 Amount Last Paid: $410.25
Next Due Date: 22 October 2020 Next Payment Amount: $410.25
Arrears F/Fee Next Due: Arrears F/Fee Amount: $25.00
Instructions Issued Before?: No
Mortgaged Vehicle: 2018 TOYOTA YARIS
Colour: WHITE
Rego No: DZW63Q
Engine No: 2NZ8751771
VIN: JTDKW3D3801001503
Repo Allowed: Yes
Payout Amount: $17,722.06, available to 1 October 2020
Default Notice Dated: 7 August 2020
Expired On: 10 September 2020
Amount Due on Notice: $785.25.

any way while combining my second variable it will create in new line instead?

Thanks, Sorry for the long post.

1 Like

Hi @Pavan_Srikar,

I hope this helps

(?<=Driver’s Licence:).*(?=Account)

image

1 Like

Thanks for the help most of my work is done with the above example.

Once again thanks for the help :slight_smile:

Great learning and understanding today.

1 Like

Cheers
Happy Learning
@Pavan_Srikar

Hi @Pradeep_Shiv

Sorry to post this here

When I am trying to Set text into a column in one job portal .instead of variable name if I give hardcode values it is not giving any error.

If I Give a variable name I am getting the below error.

Source: Name (Name) (It is a variable name that has a value assigned from matches activity)

Message: Error HRESULT E_FAIL has been returned from a call to a COM component.

Exception Type: UiPath.Core.ElementOperationException

RemoteException wrapping UiPath.Core.ElementOperationException: Error HRESULT E_FAIL has been returned from a call to a COM component. —> RemoteException wrapping System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at UiPath.UiNodeClass.Set(String bstrAttr, Object vValue)
at UiPath.Core.UiElement.Set(String attribute, Object value)
— End of inner exception stack trace —

Yesterday did the same code and got no errors ,this one was coming in the newly created code.

1 Like

Can you try using Type Into?
This is because of Browser issue or you can try Re-Installing Extension and try in IE or Edge

1 Like

Thanks,
Will try using Type Into.
Currently using the IE browser only.

1 Like

Check with Chrome,

Hi @Pradeep_Shiv

Can you help on below extraction in for regex the below string I am trying to extract in 3 different variables .

Mortgaged Vehicle: 2018 TOYOTA YARIS
Mortgaged Vehicle: 0000 ABCDEF GHIJKL

I tried and extracted the 2018 but for rest two I am unable to fetch

I used (?<=Mortgaged Vehicle:\s).[0-9]* for 2018 it was fine

Thank you

1 Like

hi @Pavan_Srikar …Here you go…

Variable 1= YourRegexvariable0).groups(1).tostring
Variable 2= YourRegexvariable0).groups(2).tostring
Variable 3= YourRegexvariable0).groups(3).tostring

Please check this post where you find the sample xaml similar to yours to handle the groups…

1 Like

(?<=Mortgaged Vehicle:\s).*

thanks, @prasath17 so in the above if I need only TOYOTA I need to use below

Variable 2= YourRegexvariable0).groups(2).tostring right ?

Thanks for the link to the regex video

@Pavan_Srikar - It

Yes…That’s correct.

Please click on the post. I have provided the solution xaml using groups in that post…

1 Like

Yeah the above fetches all 2018 TOYOTA YARIS.

In case if I need only TOYOTA and will assign to A and Extract only YARIS to B

Thanks

Sure will check that xaml file too.

Thanks

Hi @Pavan_Srikar … please find starter help here…Regex_Address_PS.zip (34.8 KB)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.