[Solved] How to delete first text? (c#)


If you have dynamic separators like this, String.Split is not suitable. Use Regex.Split instead.

You can give a pattern to Regex.Split and it will treat every substring that matches the pattern as a separator.

In this case, you need a pattern like this:

\d+\. |1|2|3|4

| are or operators. \d matches any digit character. + means match between 1 to unlimited times. \. matches the dot literally because . has special meaning in regex.

Usage:

var split = Regex.Split(text, "\\d+\\. |1|2|3|4");

And I think the text you need is at index 1 of split.

Remember to add a using directive to System.Text.RegularExpressions!

solved How to delete first text? (c#)