Adlm: [\u0640]
Arab: [ \u060C, \u061B, \u061C, \u061F, \u0640, \u064B, \u064C,
const fs = require("fs"); | |
const { unicode } = require("./Unicode"); | |
const args = process.argv.slice(2); | |
const propertyEscape = args[0]; | |
let ret = `const ${propertyEscape.toLowerCase()} = [`; | |
const regex = new RegExp(`\\p{${propertyEscape}}`, "gu"); | |
for (let i = 0; i < unicode.length; i++) { | |
if (unicode[i].match(regex)) { |
const desiredOutput = [ | |
{ | |
type: 'start_of_line', | |
startingIndex: 0, | |
lastIndex: 0, | |
group: '^', | |
children: [], | |
}, | |
{ | |
type: 'positive_lookbehind', |
const inputArray = [ | |
{ | |
type: 'start_of_line', | |
startingIndex: 0, | |
lastIndex: 0, | |
group: '^' | |
}, | |
{ | |
type: 'positive_lookbehind', | |
group: '(?<=Hello (a(ga)in))', |
/* Helper functions to generate the code points in a given script, expanding all of the values in a range */ | |
function getRange([start, stop]) { | |
start = parseInt(start, 16); | |
stop = parseInt(stop, 16); | |
const codepoints = []; | |
for (start; start <= stop; start++) { | |
codepoints.push(start.toString(16).padStart(4, '0').toUpperCase()) | |
} | |
return codepoints; |
Adlm: [\u0640]
Arab: [ \u060C, \u061B, \u061C, \u061F, \u0640, \u064B, \u064C,
Alias | Canonical property name | Matches letters and written signs belonging to _____ script |
---|---|---|
\p{Script=Adlm} | \p{Script=Adlam} | Adlam |
\p{Script=Ahom} | \p{Script=Ahom} | Ahom |
\p{Script=Hluw} | \p{Script=Anatolian_Hieroglyphs} | Anatolian Hieroglyphs |
\p{Script=Arab} | \p{Script=Arabic} | Arabic |
\p{Script=Armn} | \p{Script=Armenian} | Armenian |
\p{Script=Avst} | \p{Script=Avestan} | Avestan |
\p{Script=Bali} | \p{Script=Balinese} | Balinese |
\p{Script=Bamu} | \p{Script=Bamum} | Bamum |
let arr = ['1st', '2nd', '11th', '12th', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th', '13th']; | |
const collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'}); | |
arr.sort(collator.compare); // ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th"] | |
// If working with objects: | |
let planes = [{Model: "AT301A", Make: "Air Tractor"}, {Model: "KR-2", Make: "Starke"}, {Model: "V", Make: "Culver"}, {Model: "J-35", Make: "Beech"}]; | |
planes.sort((a, b) => collator.compare(a.Make, b.Make)); // [{"Model":"AT301A","Make":"Air Tractor"},{"Model":"J-35","Make":"Beech"},{"Model":"V","Make":"Culver"},{"Model":"KR-2","Make":"Starke"}] |
const NAME = "(?<name>.+?)"; | |
const NON_CAPTURE = "^(?<non_capture_group>\\(\\?:(?<non_capture>.+?)\\))$"; | |
const NAMED_CAPTURE = "^(?<named_capture_group>\\(\\?<" + NAME + ">(?<named_capture>.+?)\\))$"; | |
const CAPTURE = "^(?<capture_group>\\((?<capture>[^\\?:].*)\\))$"; | |
const UNICODE_REGEX_IN_UNICODE_MODE = /(?<unicode>\\u{?(?<hex>[\da-fA-F]{4,5})\}?)/g; | |
const UNICODE_REGEX_NOT_IN_UNICODE_MODE = /(?<unicode>\\u(?<hex>[\da-fA-F]{4}))/g; | |
const DIGIT = "(?<digit>\\\\d)"; | |
const NON_DIGIT = "(?<non_digit>\\\\D)"; | |
const ALPHANUMERIC = "(?<alphanumeric>\\\\w)"; | |
const NON_ALPHANUMERIC = "(?<non_alphanumeric>\\\\W)"; |