ArabicFix

THE TEXT STUDIO

Advanced find & replace

Match case, whole words or a bounded cancellable regular expression. Preview before exporting.

Processed in your browser

50,000 input units; 300 pattern; 1,000 replacement; 10,000 matches; 100,000 output. Worker terminates after 600 ms or on Cancel. Replacement code is never executed. $1 is literal by default. Whole-word boundaries use Unicode letters/marks/numbers and underscore. Editing invalidates stale results. Match positions are zero-based UTF-16 offsets.

First 200 match positions
Save & restore workspace

Explicit download/import of text and settings; no autosave or sync. The file contains your text; store it appropriately. History and voices are not saved. Up to one million text units and a 4 MB file.

From your screen to a finished page

Export the current result as a carefully paginated PDF, or keep selectable text with an embedded font.

Up to 20,000 units. The visual PDF uses approximately 150 dpi browser-shaped pages; its text is not searchable or selectable. HTML and TXT retain copyable text. Cleaner proof font and layout settings carry into export. When printing HTML, browser headers and footers are controlled by your browser.

How to find and replace in Arabic text with regular expressions

Ordinary find and replace is fine for swapping one word for another, but Arabic attaches a lot to a word: ال, و, ب and ل at the front, pronoun endings at the back. This tool gives you finer control: literal search with an optional whole-word rule, or a JavaScript regular expression that matches patterns such as “any vowel mark” or “the word with or without the article”.

The result appears in a separate box with a match count, and your original is never changed. Each search runs in an isolated worker in your browser and stops after 600 ms, so a runaway pattern cannot freeze the page.

How to use it

  1. Paste your text into Original text.
  2. Type what you are looking for in Find and the new text in Replacement (may be empty). Leave the replacement empty to delete every match.
  3. Tick Whole word if you want the word on its own, not as part of a longer word.
  4. To use a pattern instead of literal text, tick JavaScript regular expression. If you put part of the pattern in parentheses and want it back in the replacement as $1, also tick Expand $1…$99, $& and $$.
  5. Click Preview replacement. Check the match count, and open First 200 match positions to see exactly what matched.
  6. Copy the result or download it as .txt. Changing the text or any option clears the preview, so click the button again.

Worked examples from the tool

Example from the tool · ReplaceWhole word skips the word when ال, و or ب is attached: one match out of four
Original
قرأت الكتاب، ثم أعدت كتاب الرياضيات إلى المكتبة. والكتاب الثاني بكتابه.
Result
قرأت الكتاب، ثم أعدت دفتر الرياضيات إلى المكتبة. والكتاب الثاني بكتابه.

Settings: Find: كتاب · Replacement: دفتر · Whole word

Example from the tool · ReplaceA pattern that accepts ال and وال in front of the word and puts them back: three matches
Original
قرأت الكتاب، ثم أعدت كتاب الرياضيات إلى المكتبة. والكتاب الثاني بكتابه.
Result
قرأت الدفتر، ثم أعدت دفتر الرياضيات إلى المكتبة. والدفتر الثاني بكتابه.

Settings: Find: (و?ال)?كتاب · Replacement: $1دفتر · JavaScript regular expression · Whole word · Expand $1…$99, $& and $$

Example from the tool · ReplaceRemoving vowel marks, tanween, shadda and sukun with a character class: 13 matches
Original
مَرْحَبًا بِكُمْ فِي الدَّوْرَةِ
Result
مرحبا بكم في الدورة

Settings: Find: [\u064B-\u0652] · Replacement empty · JavaScript regular expression

Whole words and Arabic prefixes

Whole word means the character before and after the match is not a letter, a digit, a combining mark or an underscore. In Arabic, الكتاب, والكتاب and بكتابه all contain كتاب glued to other letters, so a whole-word search for كتاب skips them. In the first example only one of four occurrences changed.

The answer is to write the prefixes you accept into the pattern itself. With Whole word on, (و?ال)?كتاب matches كتاب, الكتاب and والكتاب, and leaves بكتابه alone because it ends in a pronoun suffix. The prefix sits in parentheses, so $1 in the replacement puts it back unchanged. Add other prefixes the same way, such as ب, ل or ف.

Useful patterns for Arabic

Each was tested in the tool:

  • [\u064B-\u0652] with an empty replacement removes vowel marks, tanween, shadda and sukun, as in the third example. Add \u0670 inside the brackets to remove superscript alef too. If that is all you need, Remove common Arabic diacritics in the Cleaner is simpler, and the guide to removing Arabic diacritics explains when to keep them.
  • [\u0621-\u064A]+ matches words written in basic Arabic letters without marks.
  • [\p{Script=Arabic}\p{M}]+ matches a whole Arabic word including its harakat.
  • [أاإآ]حمد matches أحمد, احمد and إحمد, a simple way to catch a name written with different alef forms.
  • (?<=\p{Script=Arabic}) ?, ? with the replacement “، ” turns a Latin comma after an Arabic word into an Arabic comma and leaves commas between English words alone.

Two things to watch. First, \b in JavaScript only treats ASCII letters, digits and the underscore as word characters, so \bكتاب\b matches nothing even when the word stands alone; use Whole word instead. Second, \p{Script=Arabic}+ on its own breaks a vowelled word at every mark, because Unicode assigns harakat to the “Inherited” script rather than to Arabic. That is why the pattern above adds \p{M}.

Pitfalls

  • A literal $1 in the output: Expand $1…$99, $& and $$ is off. By default the replacement is inserted exactly as typed.
  • The dot matches anything: in regular-expression mode a dot means any character, so 3.5 also matches 345. Write 3\.5, or switch regular expressions off for a literal search.
  • ^ and $ match the whole text only: tick ^ and $ per line (m) to anchor at the start or end of every line.
  • Time limit reached: nested patterns such as (a+)+$ can take an extremely long time. The search stops after 600 ms with no partial result. Simplify the pattern and try again.

Limits

  • Up to 50,000 text units of input, 300 for the pattern, 1,000 for the replacement, 10,000 matches and 100,000 units of output.
  • Whole word knows nothing about Arabic prefixes and suffixes, and there is no morphological analysis: the tool cannot tell that كتب and مكتبة share a root.
  • Search does not fold hamza, taa marbuta or diacritics. أحمد will not match احمد unless your pattern covers both.
  • Only the first 200 match positions are listed, counted in zero-based UTF-16 units.

Frequently asked questions

How do I remove Arabic diacritics with a regular expression?

Tick JavaScript regular expression, enter [\u064B-\u0652] in Find, leave the replacement empty and click Preview replacement.

Why does Whole word not find الكتاب when I search for كتاب?

Because ال is part of the same word: the character before كتاب is a lam, not a space. Put the prefix into a pattern such as (و?ال)?كتاب with regular expressions on.

Does Match case affect Arabic?

No. Arabic has no upper or lower case, so the option only matters for Latin letters.

Can I swap two words around?

Yes. The pattern (\p{L}+) (\p{L}+) with the replacement $2 $1 and group expansion on turns سارة أحمد into أحمد سارة.

Is my text or pattern sent to a server?

No. The search runs in a worker inside your browser.

Reading comfort
About ArabicFix

ArabicFix is a workspace for Arabic text: clean, write, convert and compare. Choose a tool, paste your text, then review the result before copying or downloading. Transformations are explicit and optional. Your exported text contains no branding or watermark.

Processing happens in your browser. Text and files are not uploaded, and drafts are not automatically saved. Download a workspace file to restore your work later; earlier workspace files remain compatible. These tools do not claim contextual proofreading or automatic tashkeel. Speech requires a browser-provided local Arabic voice.