Irfan_Musa
(Irfan Musa)
October 23, 2023, 2:21am
1
I have the workflow I needed to debug:
MEInfo2 variable has below regex:
System.Text.RegularExpressions.Regex.Match(MEInfo,“(?<=MAIN ENGINE\s)(.+?(?=\sAUXILIARY|\sPROPULSOR|\sPOS|\sOTHER|\sCARGO|\sENVIRONMENTAL|\sENERGY|\sLIFTING|\sBOILER|\sEMERGENCY))”).ToString.Trim
MESplitArray has below regex:
System.Text.RegularExpressions.Regex.Split(MEInfo2,“.\s(?=\d\sx)”)
Below is the data that will be used for extract:
MAIN ENGINE 2 x Diesel - WinGD 6X72DF - 2-stroke 6-cyl. 720mm x3086mm bore/stroke 26,530mkW total at 69.10rpm.
AUXILIARY 2 x Aux. Diesel Gen. - 4-stroke driving 2 x HD Hyundai Electric HSJ9 811-10P - AC generator(s) at 7,380ekW total, (9,225kVA total) 6600V at 50Hz. 2 x Aux. Diesel Gen. - 4-stroke driving 2 x HD Hyundai Electric HSJ9 803-10P - AC generator(s) at 5,540ekW total, (6,925kVA total) 6600V at 50Hz.
PROPULSOR 2 x FP Propeller (Aft) (mechanical), 69.10rpm.
OTHER ENGINE EQUIPMENT 2 x Screw Shaft.
ENVIRONMENTAL EQUIPMENT 2 x Selective Catalytic Reduction - NOx - Unknown. 2 x BWTS - Ballast Water Treatment System - SunRui BC-3000 at 3000cu.m/hr.
EMERGENCY 1 x Emergency Diesel Gen. - 4-stroke driving 1 x ac generator(s) at 50Hz.
When I run in debug mode, the MESplitArray is “Null”, I am trying to understand what this variable does and why is it Null.
Irfan_Musa
(Irfan Musa)
October 23, 2023, 2:51am
2
The variable MESplitArray will later be used in For Each:
Parvathy
(PS Parvathy)
October 23, 2023, 3:00am
3
Hi @Irfan_Musa
Try the below one:
MEInfo2 variable has below regex:
MEInfo2 = System.Text.RegularExpressions.Regex.Match(MEInfo,"(?<=MAIN ENGINE\s)(.+?(?=\sAUXILIARY|\sPROPULSOR|\sPOS|\sOTHER|\sCARGO|\sENVIRONMENTAL|\sENERGY|\sLIFTING|\sBOILER|\sEMERGENCY))").Value.Trim
MESplitArray has below regex:
MESplitArray= System.Text.RegularExpressions.Regex.Split(MEInfo2,".\s(?=\d\sx)")
Hope it helps!!
Yoichi
(Yoichi)
October 23, 2023, 3:08am
4
Hi,
In my environment, your expression returns the following result. (But number of items is 1)
Can you share your expected output?
Regards,
Irfan_Musa
(Irfan Musa)
October 23, 2023, 3:23am
5
@Yoichi , the screenshot is the desired output , as per my understanding the info after “MAIN ENGINE” will be further breakdown to smaller pieces in the For Each
Yoichi
(Yoichi)
October 23, 2023, 3:27am
6
Hi,
Can you share specific expected output?
Regards,
Parvathy
(PS Parvathy)
October 23, 2023, 3:32am
7
Hi @Irfan_Musa
Actually your split condition is returning null value. Can I know what are you trying to split from the before result so that I can help you with the modified condition.
Regards
Irfan_Musa
(Irfan Musa)
October 23, 2023, 3:34am
8
The desired output is this part:
2 x Diesel - WinGD 6X72DF - 2-stroke 6-cyl. 720mm x3086mm bore/stroke 26,530mkW total at 69.10rpm
From my end the result is showing this :
Irfan_Musa
(Irfan Musa)
October 23, 2023, 3:35am
9
The desired output is this part:
2 x Diesel - WinGD 6X72DF - 2-stroke 6-cyl. 720mm x3086mm bore/stroke 26,530mkW total at 69.10rpm
From my end the result is showing this :
Yoichi
(Yoichi)
October 23, 2023, 3:39am
10
HI,
For now can you try the following sample?
Sample20231023-4L.zip (2.8 KB)
If it works well, can you check difference of them?
Regards,
Parvathy
(PS Parvathy)
October 23, 2023, 3:47am
11
@Irfan_Musa
What is your expected output of your SplitArray. Specify.
Regards
Irfan_Musa
(Irfan Musa)
October 23, 2023, 3:53am
12
In my regex expression it has a "" at the front. I tried removing it and it still gives the same “null” result
Irfan_Musa
(Irfan Musa)
October 23, 2023, 3:54am
13
I am not sure why the forward slash "\ " is not showing
Yoichi
(Yoichi)
October 23, 2023, 3:57am
14
Hi,
It’s forum specification as Back slash is special character.
Can you try to remove back slash just before .
? .
means any character but \.
means dot literal.
Or can you share your workflow as file?
Regards,
Irfan_Musa
(Irfan Musa)
October 23, 2023, 4:04am
15
I am not entirely sure but this is the part is the desired output:
2 x Diesel - WinGD 6X72DF - 2-stroke 6-cyl. 720mm x3086mm bore/stroke 26,530mkW total at 69.10rpm
It will be use in For Each for If:
For Else:
And it will break down further with For Each variable in RegexMENO:
aliaga
(Ali Aga Mustofa)
October 23, 2023, 4:06am
16
Hi,
if expected output :
2 x Diesel - WinGD 6X72DF - 2-stroke 6-cyl. 720mm x3086mm bore/stroke 26,530mkW total at 69.10rpm
can you check this regex regex101: build, test, and debug regex
Thankyou
Parvathy
(PS Parvathy)
October 23, 2023, 4:06am
17
Hi @Irfan_Musa
Try the below one:
MEInfo2 variable has below regex:
MEInfo2 = System.Text.RegularExpressions.Regex.Match(MEInfo,"(?<=MAIN ENGINE\s)(.+?(?=\sAUXILIARY|\sPROPULSOR|\sPOS|\sOTHER|\sCARGO|\sENVIRONMENTAL|\sENERGY|\sLIFTING|\sBOILER|\sEMERGENCY))").ToString.Trim
MEInfo2 is of DataType IEnumberable(System.Text.RegularExpression.Match)
Use this variable i.e MEInfo2 in For Each.
Hope it helps!!
Irfan_Musa
(Irfan Musa)
October 23, 2023, 4:21am
18
Hi @Yoichi ,
I have removed it and it still shows “null”
I can’t share my workflow since it has credentials info.
I can share some screenshot of my currentwork flow:
Variable MEInfo2:
MESplitArray :
For Each with IF:
For Each with Else:
For Each within var RegexMENo:
Yoichi
(Yoichi)
October 23, 2023, 4:26am
19
HI,
it may be line break matter. Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(MEInfo,"(?<=MAIN ENGINE\s+)(.+?(?=\s+AUXILIARY|\s+PROPULSOR|\s+POS|\s+OTHER|\s+CARGO|\s+ENVIRONMENTAL|\s+ENERGY|\s+LIFTING|\s+BOILER|\s+EMERGENCY))").ToString.Trim
Regards,