aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-pcre/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-pcre/src')
-rw-r--r--crates/shirabe-pcre/src/preg.rs38
1 files changed, 2 insertions, 36 deletions
diff --git a/crates/shirabe-pcre/src/preg.rs b/crates/shirabe-pcre/src/preg.rs
index 491e5371..753a4678 100644
--- a/crates/shirabe-pcre/src/preg.rs
+++ b/crates/shirabe-pcre/src/preg.rs
@@ -13,15 +13,10 @@
pub use shirabe_php_shim::{CaptureKey, PregMatches, PregMatchesAll, PregMatchesAllWithOffsets};
use shirabe_php_shim::{
- PregPattern, preg_grep, preg_match_all_offset_capture, preg_match_all2, preg_match_map,
- preg_match2, preg_replace_callback, preg_replace2,
+ PregPattern, preg_grep, preg_match_all_offset_capture, preg_match_all2, preg_match2,
+ preg_replace_callback, preg_replace2,
};
-preg_match_map! {
- /// The named capture groups of a single match, keyed by group name alone.
- pub struct PregNamedGroups(String => String);
-}
-
#[derive(Debug)]
pub struct Preg;
@@ -109,35 +104,6 @@ impl Preg {
Self::match4(pattern, subject, offset)
}
- pub fn is_match_named(pattern: impl PregPattern, subject: &str) -> Option<PregNamedGroups> {
- Some(
- preg_match2(pattern, subject, 0)?
- .iter()
- .filter_map(|(key, value)| match (key, value) {
- (CaptureKey::ByName(name), Some(value)) => Some((name, value.to_string())),
- _ => None,
- })
- .collect(),
- )
- }
-
- /// `is_match3` with the groups positioned by number rather than keyed, for callers that only
- /// read numbered groups. Index 0 is the full match; an unmatched group is `None`.
- pub fn is_match_with_indexed_captures(
- pattern: impl PregPattern,
- subject: &str,
- ) -> Option<Vec<Option<String>>> {
- Some(
- preg_match2(pattern, subject, 0)?
- .iter()
- .filter_map(|(key, value)| match key {
- CaptureKey::ByIndex(_) => Some(value.map(str::to_string)),
- CaptureKey::ByName(_) => None,
- })
- .collect(),
- )
- }
-
pub fn is_match_all(pattern: impl PregPattern, subject: &str) -> PregMatchesAll {
Self::match_all2(pattern, subject)
}