Get String before space

I have a string
1.CAC - K - 40 Er Match 100.17
2.CC - X0 - 41k Max Eli/c 2,504.32

I need the output as below.

1.CAC - K - 40 Er Match
2.CC - X0 - 41k Max Eli/c

Found it has three spaces between.
I have tried split but its not working, any suggestions.

The strings you want can be retrieved using the following, where MyText is your string:

System.Text.RegularExpressions.Regex.Matches(MyText, ".*-.*-.*(?=\s\d)")

This will contain each of your parsed strings and can be iterated over using a For Each activity.

5 Likes

How do we learn to create regex expression?

A great resource is rexegg.com, and you can test your regexes at regex101.com.

Thank you :slight_smile:

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