mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 15:53:30 -07:00
Simplify regexes
This commit is contained in:
parent
42d4d64695
commit
2c0a63352c
|
|
@ -221,12 +221,10 @@ namespace DiscordChatExporter.Services
|
||||||
content = HtmlEncode(content);
|
content = HtmlEncode(content);
|
||||||
|
|
||||||
// Pre multiline (```text```)
|
// Pre multiline (```text```)
|
||||||
content = Regex.Replace(content, "```+(?:[^`]*?\\n)?([^`]+)\\n?```+",
|
content = Regex.Replace(content, "```+(?:[^`]*?\\n)?([^`]+)\\n?```+", "<div class=\"pre\">$1</div>");
|
||||||
m => "<div class=\"pre\">" + m.Groups[1].Value + "</div>");
|
|
||||||
|
|
||||||
// Pre inline (`text`)
|
// Pre inline (`text`)
|
||||||
content = Regex.Replace(content, "`([^`]+)`",
|
content = Regex.Replace(content, "`([^`]+)`", "<span class=\"pre\">$1</span>");
|
||||||
m => "<span class=\"pre\">" + m.Groups[1].Value + "</span>");
|
|
||||||
|
|
||||||
// URL links
|
// URL links
|
||||||
content = Regex.Replace(content, "((https?|ftp)://[^\\s/$.?#].[^\\s]*)",
|
content = Regex.Replace(content, "((https?|ftp)://[^\\s/$.?#].[^\\s]*)",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue