REGEXPRE in Calligra Sheets: Replace every matching number in free-form text
Learn the REGEXPRE function in Calligra Sheets with sample cells, a reproducible formula, expected results, troubleshooting and the official reference.
Reference checked: Examples have not been run in this spreadsheet application. How we verify guides
Quick answer: Replace every matching number in free-form text. You want to anonymize numeric tokens in a short equipment log before sharing it.
The syntax below follows Calligra Sheets documentation. Recreate the small dataset to understand the output before applying the formula to your own sheet.
When to use REGEXPRE
You want to anonymize numeric tokens in a short equipment log before sharing it. The calculation can then be repeated across additional rows while retaining the source values for review.
Syntax and argument order
=REGEXPRE(text; regexp; replacement)
The spelling and argument order come from the official Calligra Sheets function reference. Calligra’s official function handbook displays semicolons between arguments. Verify separators against the locale in your installed Calligra version.
Reproduce the example
Create a small worksheet with the following cells. Treat the labels as context; the formula references the specified ranges.
| Cell | Source text |
|---|---|
| A2 | 14 and 15 and 16 |
| A3 | A12-B34 |
Place the following formula in an empty cell outside the sample range:
=REGEXPRE(A2;"[0-9]+";"num")
Expected result: num and num and num.
Why it works: Every sequence of digits matches [0-9]+ and is replaced by the word num; surrounding words and spaces remain intact.
If your result differs, compare the sample values, quotation marks, argument separators, and cell references against the formula shown.
A second example
=REGEXPRE(A3;"[0-9]+";"X")
Expected result: AX-BX. Use the second result as a separate check with changed inputs.
Troubleshooting and practical cautions
Replacing all digit groups can destroy identifiers, dates and decimal values. Work on a copy, and make the pattern as specific as your data requires.
For extraction, use Calligra REGEXP instead. REGEXPRE is the replacement variant, not the extraction variant.
Compatibility and version notes
Do not assume the function name or argument order matches another spreadsheet. For example, Calligra REGEXP extracts text and REGEXPRE replaces it; PlanMaker and LibreOffice may use different names or behavior.
Verification status: KDE’s published Sheets handbook includes older material and may not describe every interface detail of the current build. This is a documentation-checked formula guide, not a native-application test. No application screenshot is presented as genuine here. Independently calculated expectations are not native-application execution in Calligra Sheets.
Browse Calligra Sheets function guides · Compare functions across eight spreadsheet programs
Documentation: Calligra Sheets reference for REGEXPRE.