mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
avoid escape characters by using a multiline string
lets concat url_scheme in combo with a multiline (thanks @qwerasd205) regex: url_scheme -> url_schemes
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