diff --git a/lib/index.ts b/lib/index.ts index 15699d2..53b2052 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -99,7 +99,7 @@ const getIsDeclaredAfter = (styleRule: CSSStyleRule) => (selector: string) => { export module python { export function getDef(code: string, functionName: string) { const regex = new RegExp( - `^(? *?)def +${functionName} *\\((?[^\\)]*)\\)\\s*:\\n(?.*?)(?=\\n\\k[\\w#]|$)`, + `^(? *?)def +${functionName} *\\((?[^\\)]*)\\)\\s*:\\s*?\\n(?.*?)(?=\\n\\k[\\w#]|$)`, "ms" ); @@ -141,7 +141,7 @@ export module python { : blockPattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const regex = new RegExp( - `^(? *?)(?${escapedBlockPattern})\\s*:\\n(?.*?)(?=\\n\\k[\\w#]|$)`, + `^(? *?)(?${escapedBlockPattern})\\s*:\\s*?\\n(?.*?)(?=\\n\\k[\\w#]|$)`, "ms" );