On Openrefine, I'm filering a column with regex. Why doesn't this give me all the cells…
- User
On Openrefine, I'm filering a column with regex. Why doesn't this give me all the cells with פרנק?
\bפרנק\b
- Assistant
Good question — this is a common gotcha in OpenRefine when working with Hebrew text and regex. Here’s why \bפרנק\b doesn’t match what you expect: 🧠 Explanation
\b in regular expressions means word boundary.
In many regex engines (including Java’s, which OpenRefine uses), “word characters” are defined as [A-Za-z0-9_] — not Hebrew letters.
That means for Hebrew, \b boundaries don’t actually apply! So \bפרנק\b will never find matches, because OpenRefine doesn’t see “word boundaries” around Hebrew words.
✅ Solutions Option 1: Match explicitly with surrounding anchors If you just want to find cells containing the word "פרנק" (even within text): javascriptCopy codevalue.match(/פרנק/)
or in the filter box: swiftCopy code/פרנק/
Option 2: To match whole words only If you want to make sure “פרנק” isn’t part of a longer Hebrew word, simulate word boundaries using lookarounds: javascriptCopy codevalue.match(/(?<!\S)פרנק(?!\S)/)
That means:
(?<!\S) → not preceded by a non-space (so start of string or whitespace)
פרנק → the word itself
(?!\S) → not followed by a non-space (so end of string or whitespace)
- User
yes
- Assistant
Perfect 👍 — here’s how to do it directly inside OpenRefine.
✅ To filter all rows containing “פרנק” anywhere: In the column menu → “Text filter” → click the small triangle → choose “Custom text filter…”, then enter: grelCopy codevalue.match(/פרנק/)
This will include any cell that has “פרנק” as part of its text — even inside longer words.
✅ To filter only rows where “פרנק” is a standalone word (not part of something like “פרנקלין”): Use this instead: grelCopy codevalue.match(/(?<!\S)פרנק(?!\S)/)
Explanation:
(?<!\S) ensures a space, punctuation, or start of string before the word.
(?!\S) ensures a space, punctuation, or end of string after it. This mimics the missing \b behavior for Hebrew.
💡 Optional: make it more robust (match punctuation, multiple spaces, etc.) You can slightly expand it: grelCopy codevalue.match(/(^|[\s,.!?])פרנק([\s,.!?]|$)/)
That also treats punctuation and line breaks as valid word boundaries.
Would you like the filter to keep matching rows or exclude them (so you only see rows without “פרנק”)? I can show both ways.