Overview
The constants module exports useful regular expressions and symbols for Arabic text processing.PATTERN_ENDS_WITH_PUNCTUATION
Regular expression to match punctuation at the end of a string.Pattern:
/[.!?؟؛]$/Matches period (.), exclamation mark (!), question mark (?), Arabic question mark (؟), or Arabic semicolon (؛) at the end of a string.SALUTATION_SYMBOL
The Unicode symbol (ﷺ) used to represent Islamic salutations.Value:
'ﷺ' (U+FDFA)This symbol represents “peace be upon him” (PBUH) and is used by replaceSalutationsWithSymbol.ARABIC_DIACRITICS_REGEX
Regular expression to match Arabic diacritical marks (tashkeel/harakāt).Pattern:
/[\u064B-\u0652\u0670\u0617-\u061A\u06D6-\u06ED]/gMatches all Arabic diacritics including fatha, damma, kasra, sukun, shadda, tanween, and others.ABBREVIATION_REGEX
Regular expression for matching common salutation abbreviations.Internal regex used by
replaceSalutationsWithSymbol to match abbreviations like PBUH, SAW, SAWS, etc.This constant is primarily used internally by the transliteration module.
ENGLISH_PHRASE_REGEX
Regular expression for matching English salutation phrases.Internal regex used by
replaceSalutationsWithSymbol to match English phrases like “peace be upon him”, “may Allah bless him”, etc.This constant is primarily used internally by the transliteration module.
PARENTHETICAL_REGEX
Regular expression for matching parenthetical salutation forms.Internal regex used by
replaceSalutationsWithSymbol to match salutations enclosed in parentheses.This constant is primarily used internally by the transliteration module.
SYMBOL_CLEANUP_REGEX
Regular expression for cleaning up dashes around the salutation symbol.Pattern:
/[‒–—―-][ \t]*ﷺ[ \t]*[‒–—―-]?|ﷺ[ \t]*[‒–—―-]/gMatches various dash characters around the ﷺ symbol for cleanup purposes.Usage notes
Most of these constants are exported for advanced use cases. For common tasks, use the higher-level functions like
replaceSalutationsWithSymbol or makeDiacriticInsensitiveRegex instead.