Crates.io | re2 |
lib.rs | re2 |
version | 0.0.8 |
source | src |
created_at | 2023-11-30 08:28:37.398017 |
updated_at | 2024-01-01 17:24:49.258596 |
description | Wrapper for the re2 C++ regex library. |
homepage | |
repository | https://github.com/cosmicexplorer/spack-rs |
max_upload_size | |
id | 1053983 |
size | 108,826 |
A wrapper of the re2 C++ library to demonstrate a use case for spack-rs.
The below syntax guide is reproduced from the re2
codebase.
This module uses the re2
library and hence supports
its syntax for regular expressions, which is similar to Perl's with
some of the more complicated things thrown away. In particular,
backreferences and generalized assertions are not available, nor is \Z
.
See Syntax1 for the syntax supported by RE2, and a comparison with PCRE and PERL regexps.
For those not familiar with Perl's regular expressions, here are some examples of the most commonly used extensions:
"hello (\\w+) world"
-- \w
matches a "word" character"version (\\d+)"
-- \d
matches a digit"hello\\s+world"
-- \s
matches any whitespace character"\\b(\\w+)\\b"
-- \b
matches non-empty string at word boundary"(?i)hello"
-- (?i)
turns on case-insensitive matching"/\\*(.*?)\\*/"
-- .*?
matches .
minimum number of times
possibleThe double backslashes are needed when writing string literals. However, they should NOT be used when writing raw string literals:
r"(hello (\w+) world)"
-- \w
matches a "word" characterr"(version (\d+))"
-- \d
matches a digitr"(hello\s+world)"
-- \s
matches any whitespace characterr"(\b(\w+)\b)"
-- \b
matches non-empty string at word
boundaryr"((?i)hello)"
-- (?i)
turns on case-insensitive matchingr"(/\*(.*?)\*/)"
-- .*?
matches .
minimum number of times
possibleWhen using UTF-8 encoding, case-insensitive matching will perform simple case folding, not full case folding.
BSD-3-Clause, in order to match re2's license.