Contact

Text Β· cross-software comparison

Extract digits using regex

Extract the digits 0042 from text without dropping leading zeros, contrasting LibreOffice REGEX, Calligra REGEXP and Apple Numbers REGEX.EXTRACT.

Task

From the literal text β€œOrder 0042”, extract the first run of digits as TEXT.

Expected output

0042 (text, leading zeros preserved)

Compatibility trap: A number parsed as an integer becomes 42; extraction should remain text unless numerical calculation is intended.

One shared five-row test dataset

The same source rows make results easier to compare. Use the CSV in any supported spreadsheet application; the ODS workbook also includes LibreOffice formula tests.

Shared formula comparison fixture (columns A through F)
Region (A)Status (B)Amount (C)SKU (D)Label (E)Units (F)
NorthOpen125SKU-101Alpha2
SouthClosed80SKU-102Beta1
NorthOpen75SKU-103Gamma3
NorthClosed50SKU-104Delta4
SouthOpen200SKU-105Epsilon1

Formula syntax and feature differences

β€œDocumented” rows cite official product help, but were not run in the destination software. A formula shown here is a migration candidate, not a guarantee of identical behaviour or file interoperability.

Formulas can be selected and copied manually. Copy buttons become available when JavaScript is ready.

LibreOffice Calc

Native tested

Version: REGEX available since LibreOffice 6.2.

Arguments: REGEX(text;pattern;[replacement];[flags])

=REGEX("Order 0042";"[0-9]+")

With no replacement, returns the first matching substring; no match yields #N/A.

Official documentation β†—

Apache OpenOffice Calc

Alternative

Arguments: RIGHT for fixed-width identifiers

=RIGHT("Order 0042";4)

The official Calc regular-expression documentation concerns matching/search functions, not a native REGEX extraction function. Fixed-width RIGHT works for this known input only.

Alternative: Not safe for varying identifier width.

Official documentation β†—

Gnumeric

Not researched

A standalone regex-extraction formula has not been established from the checked Gnumeric materials; use text tools or research a suitable regular-expression plugin before migration.

Official documentation β†—

Calligra Sheets

Documented

Arguments: REGEXP(text;regexp;[default];[backref])

=REGEXP("Order 0042";"[0-9]+")

KDE docs explicitly show REGEXP extraction and optional capture group/back-reference.

Official documentation β†—

PlanMaker

Not researched

The PlanMaker 2026 sources used here do not establish regex extraction. Do not interpret that as unsupported.

Official documentation β†—

ONLYOFFICE Spreadsheet Editor

Documented

Version: Added in 9.3 (2026).

Arguments: REGEXEXTRACT (new in ONLYOFFICE 9.3; argument syntax to confirm)

ONLYOFFICE 9.3 officially added REGEXEXTRACT. Exact argument signature and this example were not verified against the running app, so avoid a presumed copy-paste formula here.

Official documentation β†—

Apple Numbers

Documented

Arguments: REGEX.EXTRACT(text,regular-expression)

=REGEX.EXTRACT("Order 0042","[0-9]+")

Numbers has dedicated regex extraction; quoted pattern syntax should be checked with locale preferences.

Official documentation β†—

Zoho Sheet

Documented

Arguments: REGEXEXTRACT(text;regex;[return_mode];[case_sensitivity])

=REGEXEXTRACT("Order 0042";"[0-9]+")

Default mode 0 extracts the first matching substring. Mode 1 returns all matches and mode 2 returns capture groups.

Official documentation β†—

Microsoft Excel

Documented

Version: Microsoft 365 for Windows and Mac; not Excel 2021/2024 by default.

Arguments: REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])

=REGEXEXTRACT("Order 0042","[0-9]+")

Microsoft uses PCRE2 regular expressions; result is text.

Important: Vendor help checked; example not executed in this program.

Official documentation β†—

Google Sheets

Documented

Version: Current Google Sheets.

Arguments: REGEXEXTRACT(text, regular_expression)

=REGEXEXTRACT("Order 0042","[0-9]+")

Google uses RE2 syntax, unlike Excel Microsoft 365 PCRE2.

Important: Vendor help checked; example not executed in this program.

Official documentation β†—

WPS Spreadsheet

Not researched

Version: Specific version and deployment must be established

This product is listed for future comparison research; no verified formula or feature parity is asserted.

Alternative: Read the vendor help and test against the shared fixture before migrating.

Important: Not tested or verified for this function.

Collabora Office Calc

Not researched

Version: Specific version and deployment must be established

This product is listed for future comparison research; no verified formula or feature parity is asserted.

Alternative: Read the vendor help and test against the shared fixture before migrating.

Important: Not tested or verified for this function.

What changes when you migrate?

Use a test case with leading zeros, then verify both the displayed value and its text/number type.

The similarly named Calligra REGEXP and LibreOffice REGEX functions have different optional arguments and replacement functionality.

For an older tool lacking a documented extractor, a fixed-width RIGHT formula is only a fallback when identifier length is stable.

Actual LibreOffice calculation evidence

The historical results report dated October 10, 2026 records calculation-engine checks in LibreOffice Calc 25.2.3.2 using headless UNO, not a GUI or workbook round-trip check. The published manifest provides the exact input formula, checked result, and whether the test validates a scalar result rather than array spill layout.

Test ID: regex-extract. See calculation results (JSON).

Keep the zeros

The source is a literal piece of text, Order 0042. Its first numeric run is 0042, not the number 42. If this represents an invoice or part identifier, preserving the leading zeros is essential. A result that displays β€œ0042” only because of a number format is not equivalent to a text result containing four characters.

Why similar names are misleading

LibreOffice uses REGEX() for extraction when the replacement argument is omitted. Calligra names its extractor REGEXP() and provides a different optional default/back-reference interface. Apple Numbers and Zoho Sheet have explicit extractors (REGEX.EXTRACT and REGEXEXTRACT respectively).

ONLYOFFICE 9.3 introduced REGEXEXTRACT according to its release notes. Because its exact argument signature was not confirmed here, it is classified as documented with a version-specific note rather than being presented as a runnable formula.

A better test set

Check an input with no number at all, one with two separate digit runs, and one with leading zeros. Compare output type, first-match versus all-match behaviour, and how no match is reported. Regex dialect details can change the meaning of shortcuts such as \d or lookaround constructs.

Evidence standard: Only LibreOffice rows labelled β€œNative tested” were run as executable fixtures. Other entries reflect vendor help or a separately labelled workaround. Dates and versions are shown when known. Last editorial research: 2026-10-11.

← Back to all comparisons