aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
commite093b2be1c333e67c96aebb0a5291bea9ae3d6db (patch)
tree0743fad689f419959c3a898605e21485087884fa /crates/shirabe/src/repository
parent050c56ef263d90d862ef565bc1762909110e02eb (diff)
downloadphp-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.tar.gz
php-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.tar.zst
php-shirabe-e093b2be1c333e67c96aebb0a5291bea9ae3d6db.zip
refactor(preg): drop the offset argument from preg_match
Every call site but one passed offset 0. The remaining one, the UTF-8 chunking loop in Application, slices the subject instead: its pattern has no anchor or lookaround, so matching a suffix is equivalent to starting the search at that offset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository')
-rw-r--r--crates/shirabe/src/repository/array_repository.rs7
-rw-r--r--crates/shirabe/src/repository/composer_repository.rs16
-rw-r--r--crates/shirabe/src/repository/filter_repository.rs6
-rw-r--r--crates/shirabe/src/repository/path_repository.rs6
-rw-r--r--crates/shirabe/src/repository/platform_repository.rs150
-rw-r--r--crates/shirabe/src/repository/vcs/forgejo_driver.rs4
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs7
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs8
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs23
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs26
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs10
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs11
-rw-r--r--crates/shirabe/src/repository/vcs/perforce_driver.rs6
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs21
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs8
-rw-r--r--crates/shirabe/src/repository/vcs_repository.rs8
16 files changed, 124 insertions, 193 deletions
diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs
index 2e364d0e..b475b0e0 100644
--- a/crates/shirabe/src/repository/array_repository.rs
+++ b/crates/shirabe/src/repository/array_repository.rs
@@ -12,7 +12,7 @@ use crate::repository::{
RepositoryInterfaceHandle, RepositoryInterfaceWeakHandle, SearchResult,
};
use indexmap::IndexMap;
-use shirabe_php_shim::{implode, php_regex, preg_match2, preg_quote, preg_split, strtolower};
+use shirabe_php_shim::{implode, php_regex, preg_match, preg_quote, preg_split, strtolower};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
use std::rc::Weak;
@@ -357,7 +357,7 @@ impl RepositoryInterface for ArrayRepository {
let fulltext_match = mode == crate::repository::SEARCH_FULLTEXT
&& complete.is_some()
- && preg_match2(
+ && preg_match(
&regex,
&format!(
"{} {}",
@@ -368,11 +368,10 @@ impl RepositoryInterface for ArrayRepository {
.get_description()
.unwrap_or_default()
),
- 0,
)
.is_some();
- if preg_match2(&regex, &name, 0).is_some() || fulltext_match {
+ if preg_match(&regex, &name).is_some() || fulltext_match {
if mode == crate::repository::SEARCH_VENDOR {
matches.insert(
name.clone(),
diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs
index 9f6e6bf8..fbf9f767 100644
--- a/crates/shirabe/src/repository/composer_repository.rs
+++ b/crates/shirabe/src/repository/composer_repository.rs
@@ -43,7 +43,7 @@ use shirabe_php_shim::{
json_decode_assoc, parse_url, php_regex, preg_split, realpath, strtolower, strtr, urlencode,
var_export,
};
-use shirabe_php_shim::{Catch as _, preg_grep, preg_match2, preg_replace};
+use shirabe_php_shim::{Catch as _, preg_grep, preg_match, preg_replace};
use shirabe_semver::CompilingMatcher;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MatchAllConstraint;
@@ -161,7 +161,7 @@ impl ComposerRepository {
.and_then(|v| v.as_string())
.unwrap_or("")
.to_string();
- if preg_match2(php_regex!(r"{^[\w.]+\??://}"), &url_str, 0).is_none() {
+ if preg_match(php_regex!(r"{^[\w.]+\??://}"), &url_str).is_none() {
if let Some(local_file_path) = realpath(&url_str) {
// it is a local path, add file scheme
repo_config.insert(
@@ -244,10 +244,9 @@ impl ComposerRepository {
.to_string();
// force url for packagist.org to repo.packagist.org
- if let Some(match_packagist) = preg_match2(
+ if let Some(match_packagist) = preg_match(
php_regex!(r"{^(?P<proto>https?)://packagist\.org/?$}i"),
&url,
- 0,
) {
let proto = match_packagist
.name("proto")
@@ -779,10 +778,9 @@ impl ComposerRepository {
if self.has_providers()? || self.lazy_providers_url.is_some() {
// optimize search for "^foo/bar" where at least "^foo/" is present by loading this directly from the listUrl if present
- if let Some(match_groups) = preg_match2(
+ if let Some(match_groups) = preg_match(
php_regex!(r"{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i"),
&query,
- 0,
) && let Some(list_url) = self.list_url.as_ref()
{
let q = match_groups.name("query").unwrap_or_default().to_string();
@@ -2421,7 +2419,7 @@ impl ComposerRepository {
}
if url.starts_with('/') {
- if let Some(matches) = preg_match2(php_regex!(r"{^[^:]++://[^/]*+}"), &self.url, 0) {
+ if let Some(matches) = preg_match(php_regex!(r"{^[^:]++://[^/]*+}"), &self.url) {
return Ok(format!("{}{}", matches.get(0).unwrap_or_default(), url));
}
@@ -2710,7 +2708,7 @@ impl ComposerRepository {
// url-encode $ signs in URLs as bad proxies choke on them
if let Some(pos) = filename.find('$')
&& pos > 0
- && preg_match2(php_regex!(r"{^https?://}i"), &filename, 0).is_some()
+ && preg_match(php_regex!(r"{^https?://}i"), &filename).is_some()
{
filename = format!("{}%24{}", &filename[..pos], &filename[pos + 1..]);
}
@@ -3309,7 +3307,7 @@ impl ComposerRepository {
if let Some(ref patterns) = self.available_package_patterns {
for provider_regex in patterns.iter() {
- if preg_match2(provider_regex, name, 0).is_some() {
+ if preg_match(provider_regex, name).is_some() {
return Ok(true);
}
}
diff --git a/crates/shirabe/src/repository/filter_repository.rs b/crates/shirabe/src/repository/filter_repository.rs
index 3b36a969..77236a21 100644
--- a/crates/shirabe/src/repository/filter_repository.rs
+++ b/crates/shirabe/src/repository/filter_repository.rs
@@ -9,7 +9,7 @@ use crate::repository::{
RepositoryInterfaceHandle, SearchResult,
};
use indexmap::IndexMap;
-use shirabe_php_shim::{InvalidArgumentException, PhpMixed, preg_match2};
+use shirabe_php_shim::{InvalidArgumentException, PhpMixed, preg_match};
use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
@@ -123,14 +123,14 @@ impl FilterRepository {
}
if let Some(only) = &self.only {
- return preg_match2(only, name, 0).is_some();
+ return preg_match(only, name).is_some();
}
if self.exclude.is_none() {
return true;
}
- preg_match2(self.exclude.as_ref().unwrap(), name, 0).is_none()
+ preg_match(self.exclude.as_ref().unwrap(), name).is_none()
}
}
diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs
index 77cc0222..3d36f65c 100644
--- a/crates/shirabe/src/repository/path_repository.rs
+++ b/crates/shirabe/src/repository/path_repository.rs
@@ -25,7 +25,7 @@ use crate::util::Url;
use indexmap::IndexMap;
use shirabe_php_shim::{
GLOB_BRACE, GLOB_MARK, GLOB_ONLYDIR, PhpMixed, RuntimeException, defined, file_exists,
- file_get_contents, glob_with_flags, hash, php_regex, preg_match2, realpath, serialize,
+ file_get_contents, glob_with_flags, hash, php_regex, preg_match, realpath, serialize,
};
#[derive(Debug)]
@@ -158,9 +158,9 @@ impl PathRepository {
let url_matches = self.get_url_matches()?;
if url_matches.is_empty() {
- if preg_match2(php_regex!(r"{[*{}]}"), &self.url, 0).is_some() {
+ if preg_match(php_regex!(r"{[*{}]}"), &self.url).is_some() {
let mut url = self.url.clone();
- while preg_match2(php_regex!(r"{[*{}]}"), &url, 0).is_some() {
+ while preg_match(php_regex!(r"{[*{}]}"), &url).is_some() {
url = shirabe_php_shim::dirname(&url);
}
// the parent directory before any wildcard exists, so we assume it is correctly configured but simply empty
diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs
index 4ded0163..839d17d6 100644
--- a/crates/shirabe/src/repository/platform_repository.rs
+++ b/crates/shirabe/src/repository/platform_repository.rs
@@ -19,7 +19,7 @@ use indexmap::IndexMap;
use shirabe_php_rpc::PlatformInfo;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, UnexpectedValueException, array_map_str_fn,
- array_slice_strs, explode, get_class, implode, is_string, php_regex, preg_match2, preg_replace,
+ array_slice_strs, explode, get_class, implode, is_string, php_regex, preg_match, preg_replace,
str_replace, strpos, strtolower, var_export,
};
use shirabe_semver::constraint::SimpleConstraint;
@@ -315,10 +315,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// librabbitmq version => 0.9.0
- if let Some(librabbitmq_matches) = preg_match2(
+ if let Some(librabbitmq_matches) = preg_match(
php_regex!("/^librabbitmq version => (?<version>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -331,10 +330,9 @@ impl PlatformRepository {
}
// AMQP protocol version => 0-9-1
- if let Some(protocol_matches) = preg_match2(
+ if let Some(protocol_matches) = preg_match(
php_regex!("/^AMQP protocol version => (?<version>.+)$/im"),
info,
- 0,
) {
let version_str = protocol_matches
.name("version")
@@ -356,7 +354,7 @@ impl PlatformRepository {
// BZip2 Version => 1.0.6, 6-Sept-2010
if let Some(matches) =
- preg_match2(php_regex!("/^BZip2 Version => (?<version>.*),/im"), info, 0)
+ preg_match(php_regex!("/^BZip2 Version => (?<version>.*),/im"), info)
{
self.add_library(
&mut libraries,
@@ -383,10 +381,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// SSL Version => OpenSSL/1.0.1t
- if let Some(ssl_matches) = preg_match2(
+ if let Some(ssl_matches) = preg_match(
php_regex!("{^SSL Version => (?<library>[^/]+)/(?<version>.+)$}im"),
info,
- 0,
) {
let ssl_library_raw =
ssl_matches.name("library").unwrap_or_default().to_string();
@@ -413,10 +410,9 @@ impl PlatformRepository {
} else {
let (shortlib, ssl_lib);
if library.starts_with("(securetransport)") {
- if let Some(securetransport_matches) = preg_match2(
+ if let Some(securetransport_matches) = preg_match(
php_regex!("{^\\(securetransport\\) ([a-z0-9]+)}"),
&library,
- 0,
) {
shortlib = "securetransport".to_string();
let m1 = securetransport_matches
@@ -444,12 +440,11 @@ impl PlatformRepository {
}
// libSSH Version => libssh2/1.4.3
- if let Some(ssh_matches) = preg_match2(
+ if let Some(ssh_matches) = preg_match(
php_regex!(
"{^libSSH Version => (?<library>[^/]+)/(?<version>.+?)(?:/.*)?$}im"
),
info,
- 0,
) {
let ssh_library =
ssh_matches.name("library").unwrap_or_default().to_string();
@@ -467,7 +462,7 @@ impl PlatformRepository {
// ZLib Version => 1.2.8
if let Some(zlib_matches) =
- preg_match2(php_regex!("{^ZLib Version => (?<version>.+)$}im"), info, 0)
+ preg_match(php_regex!("{^ZLib Version => (?<version>.+)$}im"), info)
{
self.add_library(
&mut libraries,
@@ -484,11 +479,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// timelib version => 2018.03
- if let Some(timelib_matches) = preg_match2(
- php_regex!("/^timelib version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(timelib_matches) =
+ preg_match(php_regex!("/^timelib version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-timelib", name),
@@ -500,21 +493,19 @@ impl PlatformRepository {
}
// Timezone Database => internal
- if let Some(zoneinfo_source_matches) = preg_match2(
+ if let Some(zoneinfo_source_matches) = preg_match(
php_regex!("/^Timezone Database => (?<source>internal|external)$/im"),
info,
- 0,
) {
let external = zoneinfo_source_matches
.name("source")
.map(|s| s == "external")
.unwrap_or(false);
- if let Some(zoneinfo_matches) = preg_match2(
+ if let Some(zoneinfo_matches) = preg_match(
php_regex!(
"/^\"Olson\" Timezone Database Version => (?<version>.+?)(?:\\.system)?$/im"
),
info,
- 0,
) {
let zoneinfo_version = zoneinfo_matches
.name("version")
@@ -551,7 +542,7 @@ impl PlatformRepository {
// libmagic => 537
if let Some(magic_matches) =
- preg_match2(php_regex!("/^libmagic => (?<version>.+)$/im"), info, 0)
+ preg_match(php_regex!("/^libmagic => (?<version>.+)$/im"), info)
{
self.add_library(
&mut libraries,
@@ -581,10 +572,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
- if let Some(libjpeg_matches) = preg_match2(
+ if let Some(libjpeg_matches) = preg_match(
php_regex!("/^libJPEG Version => (?<version>.+?)(?: compatible)?$/im"),
info,
- 0,
) {
let libjpeg_version = libjpeg_matches
.name("version")
@@ -601,11 +591,9 @@ impl PlatformRepository {
)?;
}
- if let Some(libpng_matches) = preg_match2(
- php_regex!("/^libPNG Version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(libpng_matches) =
+ preg_match(php_regex!("/^libPNG Version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-libpng", name),
@@ -616,11 +604,9 @@ impl PlatformRepository {
)?;
}
- if let Some(freetype_matches) = preg_match2(
- php_regex!("/^FreeType Version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(freetype_matches) =
+ preg_match(php_regex!("/^FreeType Version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-freetype", name),
@@ -631,10 +617,9 @@ impl PlatformRepository {
)?;
}
- if let Some(libxpm_matches) = preg_match2(
+ if let Some(libxpm_matches) = preg_match(
php_regex!("/^libXpm Version => (?<versionId>\\d+)$/im"),
info,
- 0,
) {
let version_id: i64 = libxpm_matches
.name("versionId")
@@ -705,7 +690,7 @@ impl PlatformRepository {
)?;
} else {
if let Some(matches) =
- preg_match2(php_regex!("/^ICU version => (?<version>.+)$/im"), info, 0)
+ preg_match(php_regex!("/^ICU version => (?<version>.+)$/im"), info)
{
self.add_library(
&mut libraries,
@@ -719,10 +704,9 @@ impl PlatformRepository {
}
// ICU TZData version => 2019c
- if let Some(zoneinfo_matches) = preg_match2(
+ if let Some(zoneinfo_matches) = preg_match(
php_regex!("/^ICU TZData version => (?<version>.*)$/im"),
info,
- 0,
) {
let zi_version = zoneinfo_matches
.name("version")
@@ -783,10 +767,9 @@ impl PlatformRepository {
Self::imagick_get_version_string(image_magick_version);
// 6.x: ImageMagick 6.2.9 08/24/06 Q16 http://www.imagemagick.org
// 7.x: ImageMagick 7.0.8-34 Q16 x86_64 2019-03-23 https://imagemagick.org
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^ImageMagick (?<version>[\\d.]+)(?:-(?<patch>\\d+))?/"),
&image_magick_version_str,
- 0,
) {
let mut version_built =
matches.name("version").unwrap_or_default().to_string();
@@ -808,12 +791,11 @@ impl PlatformRepository {
"ldap" => {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^Vendor Version => (?<versionId>\\d+)$/im"),
info,
- 0,
) && let Some(vendor_matches) =
- preg_match2(php_regex!("/^Vendor Name => (?<vendor>.+)$/im"), info, 0)
+ preg_match(php_regex!("/^Vendor Name => (?<vendor>.+)$/im"), info)
{
let version_id: i64 = matches
.name("versionId")
@@ -864,11 +846,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// libmbfl version => 1.3.2
- if let Some(libmbfl_matches) = preg_match2(
- php_regex!("/^libmbfl version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(libmbfl_matches) =
+ preg_match(php_regex!("/^libmbfl version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-libmbfl", name),
@@ -897,12 +877,11 @@ impl PlatformRepository {
// Multibyte regex (oniguruma) version => 5.9.5
// oniguruma version => 6.9.0
} else {
- if let Some(oniguruma_matches) = preg_match2(
+ if let Some(oniguruma_matches) = preg_match(
php_regex!(
"/^(?:oniguruma|Multibyte regex \\(oniguruma\\)) version => (?<version>.+)$/im"
),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -920,10 +899,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// libmemcached version => 1.0.18
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^libmemcached version => (?<version>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -943,10 +921,9 @@ impl PlatformRepository {
_ => "".to_string(),
};
// OpenSSL 1.1.1g 21 Apr 2020
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("{^(?:OpenSSL|LibreSSL)?\\s*(?<version>\\S+)}i"),
&openssl_text_str,
- 0,
) {
let version = matches.name("version").unwrap_or_default().to_string();
let mut is_fips = false;
@@ -979,10 +956,9 @@ impl PlatformRepository {
let info = platform_info.get_extension_info(name);
// PCRE Unicode Version => 12.1.0
- if let Some(pcre_unicode_matches) = preg_match2(
+ if let Some(pcre_unicode_matches) = preg_match(
php_regex!("/^PCRE Unicode Version => (?<version>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -998,12 +974,11 @@ impl PlatformRepository {
"mysqlnd" | "pdo_mysql" => {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!(
"/^(?:Client API version|Version) => mysqlnd (?<version>.+?) /mi"
),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1019,10 +994,9 @@ impl PlatformRepository {
"mongodb" => {
let info = platform_info.get_extension_info(name);
- if let Some(libmongoc_matches) = preg_match2(
+ if let Some(libmongoc_matches) = preg_match(
php_regex!("/^libmongoc bundled version => (?<version>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1034,10 +1008,9 @@ impl PlatformRepository {
)?;
}
- if let Some(libbson_matches) = preg_match2(
+ if let Some(libbson_matches) = preg_match(
php_regex!("/^libbson bundled version => (?<version>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1069,10 +1042,9 @@ impl PlatformRepository {
// intentional fall-through to next case...
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^PostgreSQL\\(libpq\\) Version => (?<version>.*)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1089,10 +1061,9 @@ impl PlatformRepository {
"pdo_pgsql" => {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^PostgreSQL\\(libpq\\) Version => (?<version>.*)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1110,10 +1081,9 @@ impl PlatformRepository {
// Used Library => Compiled => Linked
// libpq => 14.3 (Ubuntu 14.3-1.pgdg22.04+1) => 15.0.2
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!("/^libpq => (?<compiled>.+) => (?<linked>.+)$/im"),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1185,11 +1155,9 @@ impl PlatformRepository {
"sqlite3" | "pdo_sqlite" => {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
- php_regex!("/^SQLite Library => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(matches) =
+ preg_match(php_regex!("/^SQLite Library => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-sqlite", name),
@@ -1204,11 +1172,9 @@ impl PlatformRepository {
"ssh2" => {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
- php_regex!("/^libssh2 version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(matches) =
+ preg_match(php_regex!("/^libssh2 version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-libssh2", name),
@@ -1237,12 +1203,11 @@ impl PlatformRepository {
)?;
let info = platform_info.get_extension_info("xsl");
- if let Some(matches) = preg_match2(
+ if let Some(matches) = preg_match(
php_regex!(
"/^libxslt compiled against libxml Version => (?<version>.+)$/im"
),
info,
- 0,
) {
self.add_library(
&mut libraries,
@@ -1258,11 +1223,9 @@ impl PlatformRepository {
"yaml" => {
let info = platform_info.get_extension_info("yaml");
- if let Some(matches) = preg_match2(
- php_regex!("/^LibYAML Version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(matches) =
+ preg_match(php_regex!("/^LibYAML Version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
&format!("{}-libyaml", name),
@@ -1312,11 +1275,9 @@ impl PlatformRepository {
// Linked Version => 1.2.8
} else {
let info = platform_info.get_extension_info(name);
- if let Some(matches) = preg_match2(
- php_regex!("/^Linked Version => (?<version>.+)$/im"),
- info,
- 0,
- ) {
+ if let Some(matches) =
+ preg_match(php_regex!("/^Linked Version => (?<version>.+)$/im"), info)
+ {
self.add_library(
&mut libraries,
name,
@@ -1512,10 +1473,9 @@ impl PlatformRepository {
Ok(v) => v,
Err(_) => {
extra_description = Some(format!(" (actual version: {})", pretty_version));
- if let Some(m) = preg_match2(
+ if let Some(m) = preg_match(
php_regex!("{^(\\d+\\.\\d+\\.\\d+(?:\\.\\d+)?)}"),
&pretty_version,
- 0,
) {
pretty_version = m.get(1).unwrap_or_default().to_string();
} else {
@@ -1644,7 +1604,7 @@ impl PlatformRepository {
return cached;
}
- let result = preg_match2(Self::PLATFORM_PACKAGE_REGEX, name, 0).is_some();
+ let result = preg_match(Self::PLATFORM_PACKAGE_REGEX, name).is_some();
cache.insert(name.to_string(), result);
result
}
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 90480add..4238be8f 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -17,7 +17,7 @@ use crate::util::http::Response;
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, php_regex, preg_match2,
+ PhpMixed, RuntimeException, base64_decode, explode, extension_loaded, php_regex, preg_match,
urlencode,
};
@@ -584,7 +584,7 @@ impl ForgejoDriver {
let links = explode(",", &header);
for link in links {
- if let Some(m) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), &link, 0)
+ if let Some(m) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), &link)
&& let Some(url) = m.get(1)
{
return Some(url.to_string());
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index c42ca271..d5a9334f 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -13,7 +13,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable, php_regex, preg_match2,
+ PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable, php_regex, preg_match,
preg_replace,
};
@@ -301,17 +301,16 @@ impl FossilDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i"),
url,
- 0,
)
.is_some()
{
return Ok(true);
}
- if preg_match2(php_regex!(r"!/fossil/|\.fossil!"), url, 0).is_some() {
+ if preg_match(php_regex!(r"!/fossil/|\.fossil!"), url).is_some() {
return Ok(true);
}
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index 9f8e7a80..a05e9835 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -19,7 +19,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists,
array_search_mixed, extension_loaded, http_build_query, implode, is_array, php_regex,
- preg_match2, preg_replace, strpos,
+ preg_match, preg_replace, strpos,
};
#[derive(Debug)]
@@ -84,10 +84,9 @@ impl GitBitbucketDriver {
/// @inheritDoc
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(m) = preg_match2(
+ let Some(m) = preg_match(
php_regex!(r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i"),
&self.inner.url,
- 0,
) else {
return Err(InvalidArgumentException::new(format!(
"The Bitbucket repository URL {} is invalid. It must be the HTTPS URL of a Bitbucket repository.",
@@ -798,10 +797,9 @@ impl GitBitbucketDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i"),
url,
- 0,
)
.is_none()
{
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index 62cca379..63598517 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -16,7 +16,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, preg_match2,
+ InvalidArgumentException, RuntimeException, dirname, is_dir, is_writable, preg_match,
preg_replace, realpath, sys_get_temp_dir,
};
use shirabe_php_shim::{PhpMixed, php_regex};
@@ -98,13 +98,7 @@ impl GitDriver {
.into());
}
- if preg_match2(
- php_regex!(r"{^ssh://[^@]+@[^:]+:[^0-9]+}"),
- &self.inner.url,
- 0,
- )
- .is_some()
- {
+ if preg_match(php_regex!(r"{^ssh://[^@]+@[^:]+:[^0-9]+}"), &self.inner.url).is_some() {
return Err(InvalidArgumentException::new(format!(
"The source URL {} is invalid, ssh URLs should have a port number after \":\".\nUse ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.",
self.inner.url
@@ -204,7 +198,7 @@ impl GitDriver {
if !branches.contains(&"* master".to_string()) {
for branch in &branches {
if !branch.is_empty()
- && let Some(caps) = preg_match2(php_regex!(r"{^\* +(\S+)}"), branch, 0)
+ && let Some(caps) = preg_match(php_regex!(r"{^\* +(\S+)}"), branch)
&& let Some(name) = caps.get(1)
{
self.root_identifier = Some(name.to_string());
@@ -314,10 +308,9 @@ impl GitDriver {
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty()
- && let Some(caps) = preg_match2(
+ && let Some(caps) = preg_match(
php_regex!(r"{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}"),
&tag,
- 0,
)
&& let (Some(hash), Some(name)) = (caps.get(1), caps.get(2))
{
@@ -350,11 +343,10 @@ impl GitDriver {
);
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
- && preg_match2(php_regex!(r"{^ *[^/]+/HEAD }"), &branch, 0).is_none()
- && let Some(caps) = preg_match2(
+ && preg_match(php_regex!(r"{^ *[^/]+/HEAD }"), &branch).is_none()
+ && let Some(caps) = preg_match(
php_regex!(r"{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}"),
&branch,
- 0,
)
&& let (Some(name), Some(hash)) = (caps.get(1), caps.get(2))
&& !name.starts_with('-')
@@ -375,10 +367,9 @@ impl GitDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(r"#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i"),
url,
- 0,
)
.is_some()
{
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index e9c17d30..f310da3d 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -18,7 +18,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_map,
array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array_loose,
- parse_url, php_regex, preg_match2, preg_replace, preg_split, strpos, strtolower, substr, trim,
+ parse_url, php_regex, preg_match, preg_replace, preg_split, strpos, strtolower, substr, trim,
urlencode,
};
@@ -70,12 +70,11 @@ impl GitHubDriver {
}
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(match_) = preg_match2(
+ let Some(match_) = preg_match(
php_regex!(
r"#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#"
),
&self.inner.url,
- 0,
) else {
return Err(InvalidArgumentException::new(format!(
"The GitHub repository URL {} is invalid.",
@@ -483,14 +482,14 @@ impl GitHubDriver {
let mut key: Option<String> = None;
for line in preg_split(php_regex!(r"{\r?\n}"), &funding) {
let line = trim(&line, None);
- if let Some(m) = preg_match2(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line, 0) {
+ if let Some(m) = preg_match(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line) {
let g1 = m.get(1).unwrap_or_default().to_string();
let g2 = m.get(2).unwrap_or_default().to_string();
if g2 == "[" {
key = Some(g1);
continue;
}
- if let Some(m2) = preg_match2(php_regex!(r"{^\[(.*?)\](?:\s*#.*)?$}"), &g2, 0) {
+ if let Some(m2) = preg_match(php_regex!(r"{^\[(.*?)\](?:\s*#.*)?$}"), &g2) {
let inner = m2.get(1).unwrap_or_default().to_string();
for item in array_map(
|s: &String| trim(s, None),
@@ -504,9 +503,7 @@ impl GitHubDriver {
);
result.push(entry);
}
- } else if let Some(m2) =
- preg_match2(php_regex!(r"{^([^#].*?)(?:\s+#.*)?$}"), &g2, 0)
- {
+ } else if let Some(m2) = preg_match(php_regex!(r"{^([^#].*?)(?:\s+#.*)?$}"), &g2) {
let mut entry = IndexMap::new();
entry.insert("type".to_string(), PhpMixed::String(g1.clone()));
entry.insert(
@@ -516,11 +513,11 @@ impl GitHubDriver {
result.push(entry);
}
key = None;
- } else if let Some(m) = preg_match2(php_regex!(r"{^(\w+)\s*:\s*#\s*$}"), &line, 0) {
+ } else if let Some(m) = preg_match(php_regex!(r"{^(\w+)\s*:\s*#\s*$}"), &line) {
key = Some(m.get(1).unwrap_or_default().to_string());
} else if key.is_some()
- && let Some(m) = preg_match2(php_regex!(r"{^-\s*(.+)(?:\s+#.*)?$}"), &line, 0)
- .or_else(|| preg_match2(php_regex!(r"{^(.+),(?:\s*#.*)?$}"), &line, 0))
+ && let Some(m) = preg_match(php_regex!(r"{^-\s*(.+)(?:\s+#.*)?$}"), &line)
+ .or_else(|| preg_match(php_regex!(r"{^(.+),(?:\s*#.*)?$}"), &line))
{
let mut entry = IndexMap::new();
entry.insert(
@@ -645,7 +642,7 @@ impl GitHubDriver {
};
if bits.scheme.is_none() && bits.host.is_none() {
- if preg_match2(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url, 0)
+ if preg_match(php_regex!(r"{^[a-z0-9-]++\.[a-z]{2,3}$}"), &item_url)
.is_some()
{
result[key_idx].insert(
@@ -911,12 +908,11 @@ impl GitHubDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- let Some(matches) = preg_match2(
+ let Some(matches) = preg_match(
php_regex!(
r"#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#"
),
url,
- 0,
) else {
return Ok(false);
};
@@ -1253,7 +1249,7 @@ impl GitHubDriver {
let links = explode(",", &header);
for link in &links {
- if let Some(m) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link, 0) {
+ if let Some(m) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link) {
return Some(m.get(1).unwrap_or_default().to_string());
}
}
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 6054d941..229d043b 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -19,7 +19,7 @@ use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_search_mixed,
array_shift, ctype_alnum, empty, explode, extension_loaded, implode, in_array_loose, is_array,
- is_string, ord, php_regex, preg_match2, preg_replace, strpos, strtolower,
+ is_string, ord, php_regex, preg_match, preg_replace, strpos, strtolower,
};
/// Driver for GitLab API, use the Git driver for local checkouts.
@@ -80,7 +80,7 @@ impl GitLabDriver {
///
/// SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.
pub fn initialize(&mut self) -> anyhow::Result<()> {
- let Some(match_) = preg_match2(Self::URL_REGEX, &self.inner.url, 0) else {
+ let Some(match_) = preg_match(Self::URL_REGEX, &self.inner.url) else {
return Err(InvalidArgumentException::new(format!(
"The GitLab repository URL {} is invalid. It must be the HTTP URL of a GitLab project.",
self.inner.url.clone(),
@@ -382,7 +382,7 @@ impl GitLabDriver {
// Convert the root identifier to a cacheable commit id
let mut identifier = identifier.to_string();
- if preg_match2(php_regex!(r"{[a-f0-9]{40}}i"), &identifier, 0).is_none() {
+ if preg_match(php_regex!(r"{[a-f0-9]{40}}i"), &identifier).is_none() {
let branches = self.get_branches()?;
if let Some(sha) = branches.get(&identifier) {
identifier = sha.clone();
@@ -926,7 +926,7 @@ impl GitLabDriver {
url: &str,
_deep: bool,
) -> anyhow::Result<bool> {
- let Some(match_) = preg_match2(Self::URL_REGEX, url, 0) else {
+ let Some(match_) = preg_match(Self::URL_REGEX, url) else {
return Ok(false);
};
@@ -977,7 +977,7 @@ impl GitLabDriver {
let links = explode(",", &header);
for link in &links {
- if let Some(match_) = preg_match2(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link, 0) {
+ if let Some(match_) = preg_match(php_regex!(r#"{<(.+?)>; *rel="next"}"#), link) {
return Some(match_.get(1).unwrap_or_default().to_string());
}
}
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index ada1063e..977d6b97 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -13,7 +13,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, dirname, is_dir, is_writable, php_regex, preg_match2, preg_replace,
+ PhpMixed, RuntimeException, dirname, is_dir, is_writable, php_regex, preg_match, preg_replace,
};
#[derive(Debug)]
@@ -234,7 +234,7 @@ impl HgDriver {
);
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty()
- && let Some(m) = preg_match2(php_regex!(r"(^([^\s]+)\s+\d+:(.*)$)"), &tag, 0)
+ && let Some(m) = preg_match(php_regex!(r"(^([^\s]+)\s+\d+:(.*)$)"), &tag)
{
tags.insert(
m.get(1).unwrap_or_default().to_string(),
@@ -264,7 +264,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"(^([^\s]+)\s+\d+:([a-f0-9]+))"), &branch, 0)
+ preg_match(php_regex!(r"(^([^\s]+)\s+\d+:([a-f0-9]+))"), &branch)
{
let name = m.get(1).unwrap_or_default().to_string();
if !name.starts_with('-') {
@@ -282,7 +282,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)"), &branch, 0)
+ preg_match(php_regex!(r"(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)"), &branch)
{
let name = m.get(1).unwrap_or_default().to_string();
if !name.starts_with('-') {
@@ -305,12 +305,11 @@ impl HgDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if preg_match2(
+ if preg_match(
php_regex!(
r"#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i"
),
url,
- 0,
)
.is_some()
{
diff --git a/crates/shirabe/src/repository/vcs/perforce_driver.rs b/crates/shirabe/src/repository/vcs/perforce_driver.rs
index 50aed379..16dad1e9 100644
--- a/crates/shirabe/src/repository/vcs/perforce_driver.rs
+++ b/crates/shirabe/src/repository/vcs/perforce_driver.rs
@@ -9,9 +9,7 @@ use crate::util::PerforceInterface;
use crate::util::ProcessExecutor;
use crate::util::http::Response;
use indexmap::IndexMap;
-use shirabe_php_shim::{
- BadMethodCallException, PhpMixed, RuntimeException, php_regex, preg_match2,
-};
+use shirabe_php_shim::{BadMethodCallException, PhpMixed, RuntimeException, php_regex, preg_match};
#[derive(Debug)]
pub struct PerforceDriver {
@@ -190,7 +188,7 @@ impl PerforceDriver {
url: &str,
deep: bool,
) -> anyhow::Result<bool> {
- if deep || preg_match2(php_regex!(r"#\b(perforce|p4)\b#i"), url, 0).is_some() {
+ if deep || preg_match(php_regex!(r"#\b(perforce|p4)\b#i"), url).is_some() {
return Ok(Perforce::check_server_exists(
url,
&mut ProcessExecutor::new(Some(io)),
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 3398eb59..28239452 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -15,7 +15,7 @@ use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, php_regex, preg_match2, preg_replace, stripos, strrpos, strtr,
+ PhpMixed, RuntimeException, php_regex, preg_match, preg_replace, stripos, strrpos, strtr,
substr, trim,
};
@@ -153,7 +153,7 @@ impl SvnDriver {
}
fn should_cache(&self, identifier: &str) -> bool {
- self.inner.cache.is_some() && preg_match2(php_regex!(r"{@\d+$}"), identifier, 0).is_some()
+ self.inner.cache.is_some() && preg_match(php_regex!(r"{@\d+$}"), identifier).is_some()
}
pub fn get_composer_information(
@@ -257,8 +257,7 @@ impl SvnDriver {
) -> anyhow::Result<Option<String>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
- let (path, rev) = if let Some(m) =
- preg_match2(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier, 0)
+ let (path, rev) = if let Some(m) = preg_match(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier)
&& let Some(rev) = m.get(2)
{
(m.get(1).unwrap_or_default().to_string(), rev.to_string())
@@ -291,8 +290,7 @@ impl SvnDriver {
) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
- let (path, rev) = if let Some(m) =
- preg_match2(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier, 0)
+ let (path, rev) = if let Some(m) = preg_match(php_regex!(r"{^(.+?)(@\d+)?/$}"), &identifier)
&& let Some(rev) = m.get(2)
{
(m.get(1).unwrap_or_default().to_string(), rev.to_string())
@@ -306,7 +304,7 @@ impl SvnDriver {
)?;
for line in self.inner.process.borrow().split_lines(&output) {
if !line.is_empty()
- && let Some(m) = preg_match2(php_regex!(r"{^Last Changed Date: ([^(]+)}"), &line, 0)
+ && let Some(m) = preg_match(php_regex!(r"{^Last Changed Date: ([^(]+)}"), &line)
{
let date_str = m.get(1).unwrap_or_default().to_string();
return Ok(shirabe_php_shim::date_create::<Utc>(date_str.trim())
@@ -334,7 +332,7 @@ impl SvnDriver {
let line = trim(&line, None);
if !line.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -376,8 +374,7 @@ impl SvnDriver {
for line in self.inner.process.borrow().split_lines(&output) {
let line = trim(&line, None);
if !line.is_empty()
- && let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ && let Some(m) = preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -412,7 +409,7 @@ impl SvnDriver {
let line = trim(&line, None);
if !line.is_empty()
&& let Some(m) =
- preg_match2(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line, 0)
+ preg_match(php_regex!(r"{^\s*(\S+).*?(\S+)\s*$}"), &line)
{
let rev: i64 = m.get(1).and_then(|s| s.parse().ok()).unwrap_or(0);
let path = m.get(2).unwrap_or_default().to_string();
@@ -443,7 +440,7 @@ impl SvnDriver {
deep: bool,
) -> anyhow::Result<bool> {
let url = Self::normalize_url(url);
- if preg_match2(php_regex!(r"#(^svn://|^svn\+ssh://|svn\.)#i"), &url, 0).is_some() {
+ if preg_match(php_regex!(r"#(^svn://|^svn\+ssh://|svn\.)#i"), &url).is_some() {
return Ok(true);
}
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver.rs b/crates/shirabe/src/repository/vcs/vcs_driver.rs
index 1a5ee72e..439275f1 100644
--- a/crates/shirabe/src/repository/vcs/vcs_driver.rs
+++ b/crates/shirabe/src/repository/vcs/vcs_driver.rs
@@ -13,7 +13,7 @@ use crate::util::http::Response;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
-use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded, php_regex, preg_match2};
+use shirabe_php_shim::{DATE_RFC3339, PhpMixed, extension_loaded, php_regex, preg_match};
#[derive(Debug)]
pub struct VcsDriverBase {
@@ -56,8 +56,7 @@ impl VcsDriverBase {
}
pub fn should_cache(&self, identifier: &str) -> bool {
- self.cache.is_some()
- && preg_match2(php_regex!("{^[a-f0-9]{40}$}iD"), identifier, 0).is_some()
+ self.cache.is_some() && preg_match(php_regex!("{^[a-f0-9]{40}$}iD"), identifier).is_some()
}
pub fn get_scheme(&self) -> &str {
@@ -202,8 +201,7 @@ pub trait VcsDriver: VcsDriverInterface {
fn cache_mut(&mut self) -> Option<&mut Cache>;
fn should_cache(&self, identifier: &str) -> bool {
- self.cache().is_some()
- && preg_match2(php_regex!("{^[a-f0-9]{40}$}iD"), identifier, 0).is_some()
+ self.cache().is_some() && preg_match(php_regex!("{^[a-f0-9]{40}$}iD"), identifier).is_some()
}
fn get_composer_information(
diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs
index 33de3dfb..f22ab618 100644
--- a/crates/shirabe/src/repository/vcs_repository.rs
+++ b/crates/shirabe/src/repository/vcs_repository.rs
@@ -29,8 +29,8 @@ use crate::util::Url;
use indexmap::IndexMap;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- InvalidArgumentException, PhpClass, PhpMixed, php_regex, preg_match2, preg_replace,
- str_replace, strpos,
+ InvalidArgumentException, PhpClass, PhpMixed, php_regex, preg_match, preg_replace, str_replace,
+ strpos,
};
use shirabe_semver::constraint::SimpleConstraint;
@@ -510,9 +510,7 @@ impl VcsRepository {
// broken package, version doesn't match tag
if version_normalized != parsed_tag {
if is_very_verbose {
- if preg_match2(php_regex!(r"{(^dev-|[.-]?dev$)}i"), &parsed_tag, 0)
- .is_some()
- {
+ if preg_match(php_regex!(r"{(^dev-|[.-]?dev$)}i"), &parsed_tag).is_some() {
self.io.write_error(&format!(
"<warning>Skipped tag {}, invalid tag name, tags can not use dev prefixes or suffixes</warning>",
tag