-3

I'm trying to check if there are 4 symbols in a row in a string

For example

abcde/-*,f€gh

I want to match if there is /-*,

but the symbols can change to any non-letter, non-digit or non-space

1 Answers1

-1

I think this oughta just do it:

([^a-zA-Z0-9\s]){4,}

Can use it like so:

Console.WriteLine(Regex.Match("abcde/-*,f€gh", @"([^a-zA-Z0-9\s]){4,}").Success); // Prints True
Console.WriteLine(Regex.Match("abcde/- *,f€gh", @"([^a-zA-Z0-9\s]){4,}").Success); // Prints False
Wyck
  • 5,985
  • 4
  • 34
  • 44
zaitsman
  • 7,571
  • 4
  • 35
  • 64
  • Thank you, that works exactly as I wanted. Also I'm sorry for asking with little information, this is my first question in the stackoverflow. – Arda Erbaharli May 16 '20 at 01:28