Any RegEX Expression to get the content of "Split List" in regexstorm tester?

Dears,

Any RegEX Expression to get the content “Split List” in .NET Regex Tester - Regex Storm ?

Thanks In advance

Hi,

Do you need expression which outputs like the Split List? The following expression returns string array.

System.Text.RegularExpressions.Regex.Split(yourString,"PATTERN")

Regards,

1 Like

Thanks @Yoichi , Please check this link and go to “Split List” to see what I need as output :
.NET Regex Tester - Regex Storm.

Hi,

Do you need like the following worksheet or datatable?

If so, the following will work.

arrStr = System.Text.RegularExpressions.Regex.Split(strData,"[^\w\d\-\ ]+")

dt = arrStr.Select(Function(s,i) dt.LoadDataRow({i,s},False)).CopyToDataTable()

Sample20211117-a.zip (3.0 KB)

Regards,

1 Like

Thanks @Yoichi , it’s working fine , Just need to know how to remove hyphen “-” from beginning of sentence ( highlighted here in Yellow)

Note : Dash ( big hyphen) “—” is already removed by RegEX expression shared above.

Hi,

Can you try the following expression?

strData = System.Text.RegularExpressions.Regex.Replace(strData,"(?<=^|\.\s*)-+","")

Regards,

1 Like

But this will remove even hypen in " Unix-Based" word, no? … I want it to be removed only at the beginning of word not the one in the middle.

No, this will remove hyphen at the beginning of String and after period. Can you try with actual data?

Regards,

1 Like

I didn’t remove hyphen & dash at the beginning of sentence :

Hi,

It’s replace method. regex pattern is (?<=^|\.\s*)-+

Regards,

1 Like

OK Let me check.

This gives me a list of characters instead of words :roll_eyes:

This means String?
And your expression is not same as mine.(\ is lacked) Can you try to use as the following?

strData = System.Text.RegularExpressions.Regex.Replace(strData,"(?<=^|\.\s*)-+","")

Regards,

1 Like

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