HELP!. I'm trying to split 1 text file into multiple text files

sample text file
10/20/20230208/00x
30
40
50
50
50
50
50
50
10/20/20230208/00x
30
40
50
50
50
50
50
50
60
10/20/20230208/00x
30
40
50
50
50
50
50
50
10/20/20230208/00x
30
40
50
50
50
50
50
50
70

x is some random number
i want split file startswith 10/20 :smiling_face_with_tear: can someone help me

Hi,

Can you elaborate? Does this vertical bar | mean “or”?

Regards,

I’m really sorry, it was / I typed it wrong.

@Phunya:

After reading the text into a variable, let’s try splitting with Split method:
Split(textContent, “10/20”).ToArray
Loop this Array & so each splitted text can be saved into different text files.

Hope this helps.

Regards,
Ashwini K

1 Like

Hi,

Can you try the following sample?

arrStr = System.Text.RegularExpressions.Regex.Split(strData,"(?=^10/20)",System.Text.RegularExpressions.RegexOptions.Multiline).Where(Function(s) not String.IsNullOrEmpty(s)).ToArray

Sample20230228-3L.zip (2.7 KB)

Regards,

2 Likes

Much appreciated. :pray:

1 Like

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