I have the following files, i need to capture the A00180 from each string, this is a dynamic file name that will change. I need a regex that will work with both strings, where the number between - - can be a single or double-digit. This regex will work for single-digit (?<=ADL\sOrderbook - \d - )(.*)(?=.xlsx) but I am struggling to change it to work for both files.
ADL Orderbook - 2 - A00180.xlsx
ADL Orderbook - 12 - A00180.xlsx
Gokul001
(Gokul Balaji)
February 7, 2022, 12:54pm
2
Hi @David_Bishop
Can you share the Exact output
Regards
Gokul
Yoichi
(Yoichi)
February 7, 2022, 12:55pm
3
Hi,
How about the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=ADL\sOrderbook - \d+ - )(\w*)(?=\.xlsx)").Value
Regards,
Gokul001
(Gokul Balaji)
February 7, 2022, 1:24pm
4
Hi @David_Bishop
You can try with Regex Expression
Use Assign Activity
LHS → Create an variable (Test1)
RHS → System.Text.RegularExpressions.Regex.Match(yourString,“(?<=ADL\sOrderbook - )\d{1,2} - (.*)(?=.xlsx)”).Tostring
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Use Assign Activity
LHS → Create an variable (Test2)
RHS → Split(Test1,"- ") (1)
Regards
Gokul
here are some of the file names. this may help
ADL Orderbook - 12 - AEF01.xlsx
ADL Orderbook - 5 - Z92151.xlsx
ADL Orderbook - 12 - A00750.xlsx
ADL Orderbook - 2 - W88550.xlsx
Gokul001
(Gokul Balaji)
February 7, 2022, 1:28pm
6
What kind of output do you expect ?
I am trying to capture the following information from the string.
AEF01
Z92151
A00750
W88550
Gokul001
(Gokul Balaji)
February 7, 2022, 1:32pm
8
Hi @David_Bishop
Try like the above post it will solve your query
Regards
Gokul
2 Likes
ok, thanks, i will give it a go.
thank you for your help
David
Gokul001
(Gokul Balaji)
February 7, 2022, 2:01pm
10
Let me know if you face any issue @David_Bishop
system
(system)
Closed
February 12, 2022, 8:52pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.