Currently the module uses:
preg_split('!(\[.*?\])!')
In order to avoid conflicts, I think it may useful to improve the regex, eg:
Grabbing all registered names in a array (eg: ["link", "img", "youtube", ...]) and then use such an expression (using impode("|")):
Thus resulting in:
preg_split('!(\[/?(link|img|youtube|...).*?\])!')

What are your thoughts about this?

Comments

Comment #1

drzraf created an issue. See original summary.

squall3d’s picture

Comment #2

squall3d commented

@drzraf Are you concerned about performance or the replacement being too greedy?

Matching everything that looks like a shortcode has some advantage where missing shortcode plugins will not result in rendering un-parsed shortcode to the user.

This is akin to the "Clear empty tokens" options some modules implementing tokens provide.

drzraf’s picture

Comment #3

drzraf commented

The second one: content disappearing if not correctly escaped.
There is not reason in being strict about user input.
We should rather only process parts of the input that the module can handle, and leave as-is parts which can't be processed.
If the expression gives no substitution (missing shortcode plugins at the time saving is done), then it's safer to avoid any rendering at all from this expression, rather than risking hiding legitimate input from user.

Occurrences of unescaped [...], [@], [at], [1] are much more frequent than using [custom_plugin /] + custom_plugin being disabled.

avpaderno’s picture

Comment #4

avpaderno
he/him
Primary language Italian
Location Brescia, 🇮🇹 🇪🇺
commented
Version: 8.x-1.x-dev » 2.0.x-dev