diff --git a/polaris.shopify.com/src/components/CodesandboxButton/CodesandboxButton.tsx b/polaris.shopify.com/src/components/CodesandboxButton/CodesandboxButton.tsx index a94889d5676..c26e539b27f 100644 --- a/polaris.shopify.com/src/components/CodesandboxButton/CodesandboxButton.tsx +++ b/polaris.shopify.com/src/components/CodesandboxButton/CodesandboxButton.tsx @@ -4,7 +4,7 @@ import styles from './CodesandboxButton.module.scss'; const getAppCode = (code: string) => { const lineWithFunctionName = code .split('\n') - .filter((name) => name.match(/function .*Example/g))?.[0]; + .filter((name) => name.match(/function\s+(\w+)\s*\(/))?.[0]; const functionName = lineWithFunctionName ? lineWithFunctionName.replace('function ', '').replace('() {', '') : 'Example';