Created
December 13, 2019 08:56
-
-
Save angelyordanov/e1a6aa32af8ce718ffc241430142fdc7 to your computer and use it in GitHub Desktop.
bulgarian name regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
// using the following unicode chars | |
// '\u002D' : - : HYPHEN-MINUS {hyphen or minus sign} | |
// '\u2010' : ‐ : HYPHEN | |
// '\u2011' : ‑ : NON-BREAKING HYPHEN | |
// '\u2012' : ‒ : FIGURE DASH | |
// '\u2013' : – : EN DASH | |
// '\u2014' : — : EM DASH | |
// '\u2015' : ― : HORIZONTAL BAR {quotation dash} | |
Console.WriteLine(Regex.IsMatch("Ана-Мария Петрова Иванова", @"^[^\S\r\n]*([А-Яа-я\u002D\u2010\u2011\u2012\u2013\u2014\u2015]+[^\S\r\n]+){2,}[А-Яа-я\u002D\u2010\u2011\u2012\u2013\u2014\u2015]+[^\S\r\n]*$")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment