Processed locally in your browser — not uploaded
Arabic Regex Patterns
Use a curated library of JavaScript regular expressions for common Arabic text jobs. Test patterns for Arabic words, Arabic-only input, Unicode-block characters, diacritics, Tatweel, Arabic-Indic and Persian digits, and Latin tokens inside mixed text—all locally in your browser.
Arabic Words
Find common Arabic-letter words while keeping attached diacritics.
/[\u0621-\u063A\u0641-\u064A][\u0621-\u063A\u0641-\u064A\u064B-\u065F\u0670]*/guHow to use
- Select a curated Arabic pattern by the job it performs.
- Review its purpose and limitation before copying it into production.
- Edit the sample text to verify matches against your own Arabic or mixed-direction content.
- Copy either the pattern source or the complete JavaScript regex literal.
Understanding the output
Matches use the browser's native JavaScript RegExp engine. The highlighted text and match count therefore behave the same way as the copied pattern in modern JavaScript.
Common issues & tips
- •The Arabic Unicode block includes digits, punctuation, and symbols. Do not use a block range as proof that a string contains letters only.
- •Arabic-script languages use additional letters outside the core Arabic alphabet. Choose Unicode ranges for the languages your product supports.
- •Regex is useful for shape checks and extraction, but strict name validation often rejects legitimate people.
- •\d does not match Arabic-Indic digits like ٤ — even with the u flag. Use [\u0660-\u0669] or \p{Nd}, or convert digits before parsing.
Arabic regex pattern reference
Every pattern below is tested in this tool with JavaScript's native RegExp engine. Copy the literal as-is; the flags matter.
| Pattern | Regex literal | Use it for |
|---|---|---|
| Arabic Words | /[\u0621-\u063A\u0641-\u064A][\u0621-\u063A\u0641-\u064A\u064B-\u065F\u0670]*/gu | Find common Arabic-letter words while keeping attached diacritics. |
| Arabic Text Only | /^[\u0621-\u063A\u0641-\u064A\u064B-\u065F\u0670\s]+$/u | Check whether a value contains common Arabic letters, diacritics, and whitespace only. |
| Arabic Unicode Block | /[\u0600-\u06FF]+/gu | Find characters from the main Arabic Unicode block. |
| Arabic Diacritics | /[\u064B-\u065F\u0670]/gu | Find common Arabic combining marks such as Tashkeel and dagger Alef. |
| Tatweel / Kashida | /\u0640/gu | Find Arabic elongation characters used for visual spacing. |
| Arabic-Indic Digits | /[\u0660-\u0669]+/gu | Find Arabic-Indic digit sequences from ٠ to ٩. |
| Eastern Arabic / Persian Digits | /[\u06F0-\u06F9]+/gu | Find Eastern Arabic/Persian digit sequences from ۰ to ۹. |
| Latin Tokens in Arabic Text | /[A-Za-z][A-Za-z0-9._-]*/g | Find Latin identifiers, product names, and simple technical tokens in mixed text. |
The ranges come from the Arabic Unicode block (U+0600–U+06FF): letters sit at U+0621–U+064A, combining marks (tashkeel) at U+064B–U+065F plus the dagger Alef at U+0670, Arabic-Indic digits at U+0660–U+0669, and Eastern Arabic/Persian digits at U+06F0–U+06F9.
Unicode property escapes: \p{Script=Arabic} vs \p{Script_Extensions=Arabic}
With the u flag, JavaScript supports Unicode property escapes, which cover Arabic characters outside the main block — such as presentation forms at U+FB50 and above — that a [\u0600-\u06FF] range misses. They have one trap that catches most developers:
| Character | [\u0600-\u06FF] | \p{Script=Arabic} | \p{Script_Extensions=Arabic} |
|---|---|---|---|
| Letter ب | Yes | Yes | Yes |
| Arabic-Indic digit ٢ | Yes | Yes | Yes |
| Fatha (a tashkeel mark) | Yes | No | Yes |
| Arabic comma ، | Yes | No | Yes |
| Presentation form U+FB50 | No | Yes | Yes |
Tashkeel marks and the Arabic comma are shared with other scripts, so Unicode assigns them a different Script value. A \p{Script=Arabic} check on fully vowelled text will report the marks as non-Arabic. Use Script_Extensions (short form scx) when marks and punctuation must count:
// Does the string contain any Arabic-script character, including tashkeel?const hasArabic = /\p{Script_Extensions=Arabic}/u.test(input);// Strip tashkeel and the dagger Alef before comparing or indexingconst withoutMarks = input.replace(/[\u064B-\u065F\u0670]/g, "");Frequently asked questions
- Which regex should I use to detect Arabic text?
- Use a pattern based on your actual requirement. The Arabic Unicode block finds letters, digits, punctuation, and symbols, while the Arabic Words pattern targets common Arabic letters and attached marks.
- Can I validate Arabic names with one regex?
- A strict letters-only regex often rejects legitimate names containing spaces, hyphens, apostrophes, or letters from other languages. Use permissive validation and verify only the constraints your product truly needs.
- Why doesn't \p{Script=Arabic} match Arabic diacritics?
- Tashkeel marks such as fatha and the Arabic comma are shared with other scripts, so Unicode does not assign them Script=Arabic. Use \p{Script_Extensions=Arabic} with the u flag when diacritics and Arabic punctuation must match.
- Do the patterns work in JavaScript?
- Yes. Every pattern is tested with the browser's native JavaScript RegExp engine and includes the required flags.
- Is my test text uploaded?
- No. Pattern testing runs entirely in your browser.
Related tools
Arabic Search Normalization
Normalize Arabic queries and indexed text with identical rules, then test exact, phrase, or token matching.
Arabic Text Normalizer
Standardize Arabic text — diacritics, letter variants, spacing and numerals.
Regex Tester
Test regular expressions against text with live match highlighting and capturing groups.
Arabic Developer Kit (RTL Snippets)
Copyable TypeScript functions, Next.js RTL layouts, and React BiDi isolation snippets.
Arabic Form Validation
Test inclusive or Arabic-only validation for names, phone numbers, and Arabic text with copyable JavaScript.