WordPress

Crayon Syntax Highlighter preg_replace(): Compilation Failed Fix

Crayon Syntax Highlighter plugin gives the following error when updated to my Php 7.3 version.

PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in
/home/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Open the file /public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php Change the code on line 340 as follows.

Find:

return preg_replace('/[^\w-+#]/msi', '', $id);

Replace:

return preg_replace('/[^\w\-+#]/msi', '', $id);

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top