Files
Aurora.3/code/__defines/regex.dm
skull132 14a0c7bf92 Fixes Boogaloo (#1345)
Re-adds IPC APC feeding
Removes more of the horror that is type paths in text strings when they don't have to be there :ree:
Fix a bunch of lore blurbs
SQL saving is fixededed
Mark-up REGEX now requires whitespace or line ending/starts between tokens. It doesn't grab tokens surrounded by non-whitespace characters.
Updated the server greeting to only updated saved hashes if a user actively clicks on a tab.
C4 now forces old system for itself, due to raisins.
Admin verb to toggle between global default explosion type. One round only. Requires R_DEBUG or R_SERVER, is hideable.
2016-12-31 04:32:33 +02:00

38 lines
1.3 KiB
Plaintext

// Global REGEX datums for regular use without recompiling
// The lazy URL finder. Lazy in that it matches the bare minimum
// Replicates BYOND's own URL parser in functionality.
var/global/regex/url_find_lazy
// REGEX datums used for process_chat_markup.
var/global/regex/markup_bold
var/global/regex/markup_italics
var/global/regex/markup_strike
var/global/regex/markup_underline
// Global list for mark-up REGEX datums.
// Initialized in the hook, to avoid passing by null value.
var/global/list/markup_regex = list()
// Global list for mark-up REGEX tag collection.
var/global/list/markup_tags = list("/" = list("<i>", "</i>"),
"*" = list("<b>", "</b>"),
"~" = list("<strike>", "</strike>"),
"_" = list("<u>", "</u>"))
/hook/startup/proc/initialize_global_regex()
url_find_lazy = new("((https?|byond):\\/\\/\[^\\s\]*)", "g")
markup_bold = new("((\\W|^)\\*)(\[^\\*\]*)(\\*(\\W|$))", "g")
markup_italics = new("((\\W|^)\\/)(\[^\\/\]*)(\\/(\\W|$))", "g")
markup_strike = new("((\\W|^)\\~)(\[^\\~\]*)(\\~(\\W|$))", "g")
markup_underline = new("((\\W|^)\\_)(\[^\\_\]*)(\\_(\\W|$))", "g")
// List needs to be initialized here, due to DM mixing and matching pass-by-value and -reference as it chooses.
markup_regex = list("/" = markup_italics,
"*" = markup_bold,
"~" = markup_strike,
"_" = markup_underline)
return 1