我正在尝试获取字符串中的所有单词,至少 4 个字符长且少于 10 个字符。当我使用以下正则表达式时,它只是将整个字符串作为一个单词返回。你能看看下面的例子,告诉我应该怎么写这个正则表达式吗?
string result = "Overfishing, erosion and warmer waters are feeding jellyfish blooms in coastal regions worldwide. And they're causing damage"
string[] words = Regex.Split(result, @"[\W]{4,10}");
foreach (string line in words)
{
Console.WriteLine(line);
}