Irfan_Musa
(Irfan Musa)
November 3, 2023, 8:42am
1
Hi everyone,
I am trying to extract the Model Number which is in highlighted below.
But the issue is the number after Stroke is some times 2 or 4. So I think it will cause an issue if I were to proceed with the below regex:
This is the “Get Text” from the “Preview extraction” in UiPath:
Design: MWM (Group: Caterpillar), Engine Builder: Motoren Werke Mannheim AG (MWM) - Mannheim 1 x TBD645L9 , 4 Stroke, Single Acting, In-Line (Vertical) 9 Cy. 330 x 450, Mcr: 3,825 kW (5,200 hp) at 600 rpm
Is there a way around this? I appreciate any kind of help. Thank you
Irfan_Musa
(Irfan Musa)
November 3, 2023, 8:44am
2
The Model Number is always in between the “x” and the “, 4 Stroke” but the Stroke can sometimes be “, 2 Stroke”
Parvathy
(PS Parvathy)
November 3, 2023, 8:45am
3
Hi @Irfan_Musa
Input= "MWM (Group: Caterpillar), Engine Builder: Motoren Werke Mannheim AG (MWM) - Mannheim 1 x TBD645L9, 4 Stroke, Single Acting, In-Line (Vertical) 9 Cy. 330 x 450, Mcr: 3,825 kW (5,200 hp) at 600 rpm"
Output= System.Text.RegularExpressions.Regex.Match(Input,"[A-Z]+[0-9]+[A-Z0-9]+(?=,?)").Value
Hope it helps!!
Anil_G
(Anil Gorthi)
November 3, 2023, 8:46am
4
@Irfan_Musa
Please try this
(?<=x ).*(?=, [2,4] Stroke)
if it an be any number then use this (?<=x ).*(?=, [0-9] Stroke)
Hope this helps
cheers
lrtetala
(Lakshman Reddy)
November 3, 2023, 8:50am
5
Hi @Irfan_Musa
Try this
(?<=x )([A-Z]+[0-9]+[A-Z0-9]+)(?=,?)
Irfan_Musa
(Irfan Musa)
November 3, 2023, 9:11am
6
Thank you for the help and the brief explaination.
1 Like
system
(system)
Closed
November 6, 2023, 9:11am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.