Character Class Intersection

Character class intersection is supported by Java and by Ruby 1.9 and later. It makes it easy to match any single character that must be present in two sets of characters. The syntax for this is [class&&[intersect]]. You can use the full character class syntax within the intersected character class. If the intersected class does not need a negating caret, then you can omit the nested square brackets: [class&&intersect].
The character class [a-z&&[^aeiuo]] matches a single letter that is not a vowel. In other words: it matches a single consonant. Without character class subtraction or intersection, the only way to do this would be to list all consonants: [b-df-hj-np-tv-z].
The character class [\p{Nd}&&\p{Thai}] matches any single Thai digit. [\p{Thai}&&\p{Nd}] does exactly the same.

Comments

Popular posts from this blog

HOW TO REGISTER FOR SAFETOKEN

How To Get Help In MMM Nigeria - Mavrodi Mondial Moneybox