How to take the middle data with matches?

1D NOV/1D DEC: 5
3D NOV/3D DEC: 5
4D NOV/4D DEC: 5

How can I take NOV/1D,Nov/3D,NOV/4D?
Best regards
Lwin Moe Aung

Hi @LwinMoeAUNG,

You can use regex or substring to get the data easily.



Thanks for reply,
I tried them.But I didn’t get it.Could you provide source code?

Lwin Moe Aung

Use below regex pattern to get the data

Pattern :\D{3}\/.\D



I will try it.
Thanks for providing.:relaxed:

Best regards,
Lwin Moe Aung

I cannot use it because I use not only : \D{3}/.\D but also “(?<=4. OSN Spread Notionally : )[\s\S]".
I use like that "(?<=4. OSN Spread Notionally : )[\s\S](: \D{3}/.\D)

I mentioned form that I want to get data below.

  1. First Title

    First’s passage…

2.Second title

Second's passage......
  1. Fourth title

1D NOV/1D DEC: 55

2D DEC/2D DEC: 54

3D DEC/1D JAN '19: 53

From above mentioned form,
I want to get Nov/1D,DEC/2D,DEC/1D without other data.
Could you help me,please?

Regards ,
Lwin Moe Aung

@LwinMoeAUNG Has @arivu96 mentioned regex is working have a look Here

Yes bro.
But I found this error.

parsing “\H{3}\/.\H” - Unrecognized escape sequence \H.",

Hi please find the attached solution. It’s generic in nature as long as the middle string is calculated based on spaces.

For the attached solution the below input was taken, the values in BOLD is the expected answer:

String1 String2
String1 String2 String3
String1 String2 String3 String4
String1 String2 String3 String4 String5

if the Data is in Excel you can read it using Excel application scope and read range and then instead of for each you can use for each row and input will become the required column of each row.

Find Middle (4.2 KB)


Thank you for reply,
I got with split.:grinning:

item.Split(" "c)(1)

Please mark the answers as solution then and close the thread :slight_smile:

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