tangled
alpha
login
or
join now
isabelroses.com
/
blahaj
1
fork
atom
silly goober bot
1
fork
atom
overview
issues
pulls
pipelines
fix: regex not liking this format
isabelroses.com
2 years ago
569335b7
dd10d5a1
+1
-11
1 changed file
expand all
collapse all
unified
split
src
event_handler
code_expantion.rs
+1
-11
src/event_handler/code_expantion.rs
···
23
23
24
24
async fn extract_code_blocks(msg: String, client: &Client) -> Result<Vec<String>> {
25
25
let re = Regex::new(
26
26
-
r#"(?x)
27
27
-
https?://
28
28
-
(?P<host>
29
29
-
(git.*|codeberg\.org)) /
30
30
-
(?P<repo> [\w-]+/[\w.-]+) /
31
31
-
(blob|(src/(commit|branch)))? /
32
32
-
(?P<reference> \S+?) /
33
33
-
(?P<file> \S+) #L
34
34
-
(?P<start> \d+)
35
35
-
(?:[~-]L?(?P<end>\d+)?)?
36
36
-
"#,
26
26
+
r"https?://(?P<host>(git.*|codeberg\.org))/(?P<repo>[\w-]+/[\w.-]+)/(blob|(src/(commit|branch)))?/(?P<reference>\S+?)/(?P<file>\S+)#L(?P<start>\d+)(?:[~-]L?(?P<end>\d+)?)?",
37
27
)?;
38
28
39
29
let mut blocks: Vec<String> = Vec::new();