From 941701004f2ab9ed1f2aeeed1608c4e3c4d166d0 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 3 Sep 2014 12:52:22 +0000 Subject: [PATCH] Simplify the regex in markdown to found the emphasis strings git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1793 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- markdown.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown.php b/markdown.php index 2e2f9d0..3abb52d 100644 --- a/markdown.php +++ b/markdown.php @@ -68,10 +68,10 @@ class markdown $search[] = "/^--+ (.+)( --+)?$/Um"; $replace[] = "

\n

\\1

\n

"; // EMPHASIS : _ or * for normal, __ or ** for strong - $search[] = "/__([^_]+)__/"; $replace[] = "\\1"; - $search[] = "/_([^_]+)_/"; $replace[] = "\\1"; - $search[] = "/\*\*([^*]+)\*\*/"; $replace[] = "\\1"; - $search[] = "/\*([^*]+)\*/"; $replace[] = "\\1"; + $search[] = "/__(.+)__/U"; $replace[] = "\\1"; + $search[] = "/_(.+)_/U"; $replace[] = "\\1"; + $search[] = "/\*\*(.+)\*\*/U"; $replace[] = "\\1"; + $search[] = "/\*(.+)\*/U"; $replace[] = "\\1"; // CODE : `code` -> $search[] = "/\\n?\`((\\n|.)+)\`/Um";