starman to Lemmy Bots and ToolsEnglish · edit-21 year agoRegex for lemmy spoilersmessage-squaremessage-square3fedilinkarrow-up15arrow-down10file-text
arrow-up15arrow-down1message-squareRegex for lemmy spoilersstarman to Lemmy Bots and ToolsEnglish · edit-21 year agomessage-square3fedilinkfile-text
Through trial and errors, I’ve created regex for lemmy spoilers: /:::\sspoiler\s+(?<title>.+)\n(?<body>[\s\S]+?)\n:::/g link to regex101.com with explanation
minus-squarePerhyte@lemmy.worldlinkfedilinkEnglisharrow-up2·edit-21 year agoYou need a $ at the end to ensure the final ::: is on a line by itself. For example: ::: spoiler Example Content ::: More content Additional content ::: is rendered as one big spoiler block: Example Content ::: More content Additional content even though it has a line starting with ::: in the middle.
You need a
$
at the end to ensure the final:::
is on a line by itself.For example:
is rendered as one big spoiler block:
Example
Content
::: More content
Additional content
even though it has a line starting with
:::
in the middle.