Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For this you have to use Unicode character properties and blocks. Each Unicode code points has assigned some properties, e.g. this point is a Letter. Blocks are code point ranges.</p> <p>For more details, see:</p> <ul> <li><p><a href="http://www.regular-expressions.info/unicode.html" rel="noreferrer">regular-expressions.info for some general information about Unicode code points, character properties, scripts and blocks</a></p></li> <li><p><a href="http://msdn.microsoft.com/en-US/library/20bw873z%28v=vs.100%29.aspx" rel="noreferrer">MSDN for the supported properties and blocks in .net</a></p></li> </ul> <p>Those Unicode Properties and blocks are written <code>\p{Name}</code>, where "Name" is the name of the property or block.</p> <p>When it is an uppercase "P" like this <code>\P{Name}</code>, then it is the negation of the property/block, i.e. it matches anything else.</p> <p>There are e.g. some properties (only a short excerpt):</p> <ul> <li>L ==> All letter characters.</li> <li>Lu ==> Letter, Uppercase</li> <li>Ll ==> Letter, Lowercase</li> <li>N ==> All numbers. This includes the Nd, Nl, and No categories.</li> <li>Pc ==> Punctuation, Connector</li> <li>P ==> All punctuation characters. This includes the Pc, Pd, Ps, Pe, Pi, Pf, and Po categories.</li> <li>Sm ==> Symbol, Math</li> </ul> <p>There are e.g. some blocks (only a short excerpt):</p> <ul> <li>0000 - 007F ==> IsBasicLatin</li> <li>0400 - 04FF ==> IsCyrillic</li> <li>1000 - 109F ==> IsMyanmar</li> </ul> <p><strong>What I used in the solution:</strong></p> <p><code>\P{L}</code> is a character property that is matching any character that is not a letter ("L" for Letter)</p> <p><code>\p{IsBasicLatin}</code> is a Unicode block that matches the code points 0000 - 007F</p> <p>So your regex would be:</p> <pre><code>^[\P{L}\p{IsBasicLatin}]+$ </code></pre> <p><strong>In plain words:</strong></p> <p>This matches a string from the start to the end (<code>^</code> and <code>$</code>), When there are (at least one) only non letters or characters from the ASCII table (doce points 0000 - 007F)</p> <p><strong>A short c# test method:</strong></p> <pre><code>string[] myStrings = { "Foobar", "Foo@bar!\"§$%&amp;/()", "Föobar", "fóÓè" }; Regex reg = new Regex(@"^[\P{L}\p{IsBasicLatin}]+$"); foreach (string str in myStrings) { Match result = reg.Match(str); if (result.Success) Console.Out.WriteLine("matched ==&gt; " + str); else Console.Out.WriteLine("failed ==&gt; " + str); } Console.ReadLine(); </code></pre> <p><strong>Prints:</strong></p> <blockquote> <p>matched ==> Foobar<br> matched ==> Foo@bar!\"§$%&amp;/()<br> failed ==> Föobar<br> failed ==> fóÓè</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload