1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 22:27:25 +08:00
osu-lazer/osu.Game
Bartłomiej Dach a8f16503e2 Add backslash escaping to new link format
For users to be able to add square brackets inside of links using
the new format, the regular expression used for parsing those links
contained a balancing group, which can be used for matching pairs
of tokens (in this case, opening and closing brackets, in that order).
However, this means that users could not post links with unmatched
brackets inside of them (ie. ones that contain single brackets, or
a closing bracket and then an opening one). Allow for escaping opening
and closing brackets using the backslash character.

The change substitutes this old fragment of the regex in the display
text group:

    [^\[\]]*        // any character other than closing/opening bracket

for this one:

    (((?<=\\)[\[\]])|[^\[\]])*

The second pattern in the alternative remains the same; the first one
performs the escaping, as follows:

    (
        (?<=\\)     // positive lookbehind expression:
                    // this match will succeed, if the next expression
                    // is preceded by a single backslash
        [\[\]]      // either an opening or closing brace
    )

Since the entire display group is matched, unfortunately the lookbehind
expression does not actually strip the backslashes, so they are
manually stripped in handleMatches.

As demonstrated in the unit tests attached, this also allows balanced
brackets to be mixed with escaped ones.
2019-09-03 23:18:39 +02:00
..
Audio Fix skinning support for combobreak 2019-06-30 21:58:30 +09:00
Beatmaps Merge remote-tracking branch 'upstream/master' into beatmapset-genre-language 2019-09-02 13:45:25 +09:00
Configuration Merge branch 'master' into accuracy-bar 2019-08-30 15:21:32 +09:00
Database Don't share single scheduler across all model managers 2019-08-08 18:26:07 +09:00
Graphics Improve xmldoc 2019-09-03 19:21:24 +09:00
Input Update in line with framework changes 2019-08-27 18:43:58 +09:00
IO Add test for rollback logic correctly dereferencing files 2019-06-10 16:45:45 +09:00
IPC Move ArchiveModelManager import process to async flow 2019-06-10 13:42:22 +09:00
Migrations Update migrations 2019-07-08 10:44:23 +03:00
Online Add backslash escaping to new link format 2019-09-03 23:18:39 +02:00
Overlays Merge remote-tracking branch 'upstream/master' into consistent-mod-button-sounds 2019-09-03 19:18:59 +09:00
Properties Merge branch 'master' into correct-preview-loop 2019-01-31 10:53:09 +01:00
Replays
Rulesets Merge remote-tracking branch 'upstream/master' into non-timeoffset-judgements 2019-09-03 13:07:58 +09:00
Scoring Fix legacy scores with no online ID being imported with a non-null ID 2019-07-29 18:36:07 +09:00
Screens Move hit windows lookup to DrawableRuleset 2019-09-03 13:05:03 +09:00
Skinning Revert SkinnableSprite lookups to old behaviour 2019-09-03 14:21:54 +09:00
Storyboards Add sample path to the lookup names 2019-08-23 14:55:06 +03:00
Tests Move autoplay mod to a less overridable location 2019-09-02 13:24:39 +09:00
Users Merge branch 'master' into previous-usernames 2019-08-13 14:21:44 +09:00
Utils Cleanup 2019-08-28 20:15:28 +09:00
osu!.res And then everything became one 2017-09-19 16:06:58 +09:00
osu.Game.csproj Bump ppy.osu.Game.Resources from 2019.903.0 to 2019.903.1 2019-09-03 09:18:24 +00:00
OsuGame.cs Add "osu!classic" as a bundled skin choice 2019-08-29 16:39:42 +09:00
OsuGameBase.cs Add "osu!classic" as a bundled skin choice 2019-08-29 16:39:42 +09:00