मैं नियमित अभिव्यक्तियों (Regular Expressions) का दीवाना हूँ। जब मैं ऐसे श्लोक खोजने के लिए regex लिख रहा था जिनमें अंत में विराम चिह्न नहीं है:
[^\\][^\p{P}\d]\r\n\\v
या
[^\\l][^\p{P}\d]\r\n\\v \d+ \p{Lu}
, तब मुझे एहसास हुआ कि RegexPal (और FLEx फ़िल्टरिंग/प्रोसेस) में C# फ्लेवर के RegEx में शॉर्टहैंड (लॉन्गहैंड नहीं) यूनिकोड वर्ण श्रेणियाँ समर्थित हैं।
सबसे उपयोगी में से कुछ ये हैं:
\p{L} अक्षर (लगभग किसी भी लिपि में)
\p{Lu} बड़ा अक्षर (Uppercase letter)
\p{Ll} छोटा अक्षर (Lowercase letter)
\p{P} विराम चिह्न (Punctuation)
\p{M} कोई भी दीयाक्रिटिक (diacritic)
यदि स्लैश के बाद P बड़ा (capital) है, तो इसका अर्थ है कि वह वर्ण श्रेणी नहीं है (NOT)।
\P{L} कोई भी गैर-अक्षर (non-letter)
पूरी सूची:
\p{L}: किसी भी भाषा का किसी भी प्रकार का अक्षर।
\p{Ll}: एक छोटा अक्षर जिसका बड़ा (uppercase) रूप मौजूद है।
\p{Lu}: एक बड़ा अक्षर जिसका छोटा (lowercase) रूप मौजूद है।
\p{Lt}: एक अक्षर जो शब्द के आरंभ में तब दिखाई देता है जब शब्द के केवल पहले अक्षर को बड़ा (capitalized) किया जाता है।
\p{L&}: एक अक्षर जो छोटे और बड़े दोनों रूपों में मौजूद है (Ll, Lu और Lt का संयोजन)।
\p{Lm}: एक विशेष चिह्न जो अक्षर की तरह उपयोग किया जाता है।
\p{Lo}: एक अक्षर या आइडियोग्राफ़ (ideograph) जिसके छोटे और बड़े रूप नहीं होते।
\p{M}: एक ऐसा चिह्न जिसे किसी अन्य चिह्न के साथ जोड़ने के लिए तैयार किया गया है (जैसे कि स्वर-चिह्न, उमलॉट्स, घेरे हुए बॉक्स, आदि)।
\p{Mn}: एक ऐसा चिह्न जिसे किसी अन्य चिह्न के साथ जोड़ने के लिए तैयार किया गया है बिना अतिरिक्त स्थान लेने के (जैसे कि स्वर-चिह्न, उमलॉट्स, आदि)।
\p{Mc}: एक ऐसा चिह्न जिसे किसी अन्य चिह्न के साथ जोड़ने के लिए तैयार किया गया है और जो अतिरिक्त स्थान लेता है (अनेक पूर्वी भाषाओं में स्वर-चिह्न)।
\p{Me}: एक ऐसा चिह्न जो जिस चिह्न के साथ जोड़ा जाता है, उसे घेर लेता है (वृत्त, वर्ग, कीकैप, आदि)।
\p{Z}: किसी भी प्रकार का व्हाइटस्पेस या अदृश्य विभाजक।
\p{Zs}: एक व्हाइटस्पेस चिह्न जो अदृश्य है, लेकिन स्थान लेता है।
\p{Zl}: लाइन विभाजक चिह्न U+2028।
\p{Zp}: अनुच्छेद विभाजक चिह्न U+2029।
\p{S}: गणितीय प्रतीक, मुद्रा चिह्न, डिंगबैट्स (dingbats), बॉक्स-ड्रॉइंग चिह्न, आदि।
\p{Sm}: कोई भी गणितीय प्रतीक।
\p{Sc}: कोई भी मुद्रा चिह्न।
\p{Sk}: एक संयोजक चिह्न (mark) जो अपने आप में एक पूर्ण चिह्न के रूप में होता है।
\p{So}: विभिन्न प्रतीक जो गणितीय प्रतीक, मुद्रा चिह्न या संयोजक चिह्न नहीं हैं।
\p{N}: किसी भी लिपि में किसी भी प्रकार का संख्यात्मक चिह्न।
\p{Nd}: आइडियोग्राफिक लिपियों को छोड़कर किसी भी लिपि में शून्य से नौ तक का अंक।
\p{Nl}: एक संख्या जो अक्षर जैसी दिखती है, जैसे कि रोमन अंक।
\p{No}: एक सुपरस्क्रिप्ट या सबस्क्रिप्ट अंक, या एक संख्या जो 0–9 का अंक नहीं है (आइडियोग्राफिक लिपियों की संख्याओं को छोड़कर)।
\p{P}: किसी भी प्रकार का विराम चिह्न।
\p{Pd}: किसी भी प्रकार का हाइफ़न या डैश।
\p{Ps}: किसी भी प्रकार का खुलने वाला ब्रैकेट।
\p{Pe}: किसी भी प्रकार का बंद होने वाला ब्रैकेट।
\p{Pi}: किसी भी प्रकार का खुलने वाला उद्धरण चिह्न।
\p{Pf}: किसी भी प्रकार का बंद होने वाला उद्धरण चिह्न।
\p{Pc}: एक विराम चिह्न, जैसे कि अंडरस्कोर, जो शब्दों को जोड़ता है।
\p{Po}: किसी भी प्रकार का विराम चिह्न जो डैश, ब्रैकेट, उद्धरण चिह्न या कनेक्टर नहीं है।
\p{C}: अदृश्य नियंत्रण चिह्न और अप्रयुक्त कोड पॉइंट।
\p{Cc}: एक ASCII या Latin-1 नियंत्रण चिह्न: 0x00–0x1F और 0x7F–0x9F।
\p{Cf}: अदृश्य प्रारूपण संकेतक।
\p{Co}: निजी उपयोग के लिए आरक्षित कोई भी कोड पॉइंट।
\p{Cs}: UTF-16 एन्कोडिंग में सरोगेट जोड़ी (surrogate pair) का आधा हिस्सा।
\p{Cn}: कोई भी कोड पॉइंट जिसके लिए कोई चिह्न निर्दिष्ट नहीं किया गया है।
पूर्ण दस्तावेज़ीकरण:
https://www.regular-expressions.info/unicode.html#category
I’m a Regular Expressions nerd. While I was writing a regex to look for verses with no ending punctuation:
[^\\][^\p{P}\d]\r\n\\v
or
[^\\l][^\p{P}\d]\r\n\\v \d+ \p{Lu}
, I realized that the C# flavor of RegEx in RegexPal (and FLEx filtering/Process) supports shorthand (not longhand) Unicode character categories.
Some of the most useful are:
\p{L} Letter (nearly any orthography)
\p{Lu} Uppercase letter
\p{Ll} Lowercase letter
\p{P} Punctuation
\p{M} Any diacritic
If the P after the slash is capital, it means NOT that character class.
The whole list:
\p{L}: any kind of letter from any language.
\p{Ll}: a lowercase letter that has an uppercase variant.
\p{Lu}: an uppercase letter that has a lowercase variant.
\p{Lt}: a letter that appears at the start of a word when only the first letter of the word is capitalized.
\p{L&}: a letter that exists in lowercase and uppercase variants (combination of Ll, Lu and Lt).
\p{Lm}: a special character that is used like a letter.
\p{Lo}: a letter or ideograph that does not have lowercase and uppercase variants.
\p{M}: a character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.).
\p{Mn}: a character intended to be combined with another character without taking up extra space (e.g. accents, umlauts, etc.).
\p{Mc}: a character intended to be combined with another character that takes up extra space (vowel signs in many Eastern languages).
\p{Me}: a character that encloses the character it is combined with (circle, square, keycap, etc.).
\p{Z}: any kind of whitespace or invisible separator.
\p{Zs}: a whitespace character that is invisible, but does take up space.
\p{Zl}: line separator character U+2028.
\p{Zp}: paragraph separator character U+2029.
\p{S}: math symbols, currency signs, dingbats, box-drawing characters, etc.
\p{Sm}: any mathematical symbol.
\p{Sc}: any currency sign.
\p{Sk}: a combining character (mark) as a full character on its own.
\p{So}: various symbols that are not math symbols, currency signs, or combining characters.
\p{N}: any kind of numeric character in any script.
\p{Nd}: a digit zero through nine in any script except ideographic scripts.
\p{Nl}: a number that looks like a letter, such as a Roman numeral.
\p{No}: a superscript or subscript digit, or a number that is not a digit 0–9 (excluding numbers from ideographic scripts).
\p{P}: any kind of punctuation character.
\p{Pd}: any kind of hyphen or dash.
\p{Ps}: any kind of opening bracket.
\p{Pe}: any kind of closing bracket.
\p{Pi}: any kind of opening quote.
\p{Pf}: any kind of closing quote.
\p{Pc}: a punctuation character such as an underscore that connects words.
\p{Po}: any kind of punctuation character that is not a dash, bracket, quote or connector.
\p{C}: invisible control characters and unused code points.
\p{Cc}: an ASCII or Latin-1 control character: 0x00–0x1F and 0x7F–0x9F.
\p{Cf}: invisible formatting indicator.
\p{Co}: any code point reserved for private use.
\p{Cs}: one half of a surrogate pair in UTF-16 encoding.
\p{Cn}: any code point to which no character has been assigned.
Full Documentation:
https://www.regular-expressions.info/unicode.html#category
English से मशीन-अनुवादित मूल दिखाएं