regex_numbers {doseminer}R Documentation

Regular expression to match numbers in English

Description

A regex pattern to identify natural language English number phrases, such as "one hundred and fifty" or "thirty-seven". Used internally by replace_numbers to identify substrings to replace with their decimal representation.

Usage

regex_numbers

Format

An object of class character of length 1.

Details

This is a PCRE (Perl type) regular expression, so it must be used with perl = TRUE in base R regex functions. The packages stringr and stringi are based on the alternative ICU regular expression engine, so they cannot use this pattern.

Note

There is limited support for fractional expressions like "one half". The original pattern did not support expressions like "a thousand", but it has been adapted to offer (experimental) support for this. Phrases like "million" or "thousand" with no prefix will not match.

Source

https://www.rexegg.com/regex-trick-numbers-in-english.html


[Package doseminer version 0.1.2 Index]