I'm looking for a regular expression tester for Google Big Data (RE2) reg expressions. There are a few testers out there, but none of them seems to understand my statement. These are the ones I've tried and they've worked for simple expressions but not with mine:
This is my regex:
^(?:1-)?((?:R|RO|Ro)?[:|.]?\\s?\\d{3}[-|.]?\\d{4}[-|/]F\\d{2}-\\d{2})$
where I would process strings like these:
Does anyone have an idea of how I might enter the statement different or where I could test it?
You can use
^(?:1-)?((?:R[Oo]?)?[:.]?\s?\d{3}[-.]?\d{4}[-/](?:F\d{2}(?:-\d{2})?|\d{3}[-/]\d{3}))$
See the regex demo. Details:
^
- start of string(?:1-)?
- an optional 1-
string((?:R[Oo]?)?[:.]?\s?\d{3}[-.]?\d{4}[-/](?:F\d{2}(?:-\d{2})?|\d{3}[-/]\d{3}))
- Group 1:
(?:R[Oo]?)?
- an optional sequence of R
and then an optional O
or o
[:.]?
- an optional :
or .
\s?
- an optional whitespace\d{3}
- three digits[-.]?
- an optional -
or .
\d{4}
- four digits[-/]
- -
or /
(?:F\d{2}(?:-\d{2})?|\d{3}[-/]\d{3})
- either F
, two digits and then an optional sequence of -
and two digits, or three digits, -
or /
and three digits$
- end of string.See the Google Sheets demo: