diff --git a/lib/lexer.js b/lib/lexer.js index ce3ebe5c..8e209b0c 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -623,8 +623,8 @@ MULTI_DENT = /^(?:\n[^\n\S]*)+/; SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; - REGEX = /^\/(?!\s)[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4}(?![A-Za-z0-9])/; - HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?![A-Za-z])/; + REGEX = /^\/(?!\s)[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4}(?!\w)/; + HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; HEREGEX_OMIT = /\s+(?:#.*)?/g; MULTILINER = /\n/g; HEREDOC_INDENT = /\n+([^\n\S]*)/g; diff --git a/src/lexer.coffee b/src/lexer.coffee index 592e4662..b651edbc 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -585,10 +585,10 @@ REGEX = /// ^ ] ) [^ [ / \n \\ ]* )* - / [imgy]{0,4} (?![A-Za-z0-9]) + / [imgy]{0,4} (?!\w) /// -HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?![A-Za-z])/ +HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/ HEREGEX_OMIT = /\s+(?:#.*)?/g