mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
Merge pull request #2160 from erf/regex-avoid-escape-chars
regex: avoid escape characters by using a multiline string
This commit is contained in:
@ -22,8 +22,13 @@ const oni = @import("oniguruma");
|
|||||||
///
|
///
|
||||||
/// There are many complicated cases where these heuristics break down, but
|
/// There are many complicated cases where these heuristics break down, but
|
||||||
/// handling them well requires a non-regex approach.
|
/// handling them well requires a non-regex approach.
|
||||||
pub const regex = "(?:" ++ url_scheme ++ ")(?:[\\w\\-.~:/?#\\[\\]@!$&*+,;=%]+(?:\\(\\w*\\))?)+(?<!\\.)";
|
pub const regex =
|
||||||
const url_scheme = "https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news:";
|
"(?:" ++ url_schemes ++
|
||||||
|
\\)(?:[\w\-.~:/?#\[\]@!$&*+,;=%]+(?:\(\w*\))?)+(?<!\.)
|
||||||
|
;
|
||||||
|
const url_schemes =
|
||||||
|
\\https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news:
|
||||||
|
;
|
||||||
|
|
||||||
test "url regex" {
|
test "url regex" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
Reference in New Issue
Block a user