diff --git a/src/containers/import-modal.jsx b/src/containers/import-modal.jsx index cb5b169bc29e5d44b67fa2384fdcd005e0e5262a..1c2ddbefbb4639cec62cbf37fc7ceae33a45dbc8 100644 --- a/src/containers/import-modal.jsx +++ b/src/containers/import-modal.jsx @@ -51,13 +51,13 @@ class ImportModal extends React.Component { this.setState({inputValue: e.target.value, hasValidationError: false}); } validate (input) { - const urlMatches = input.match(/^(https:\/\/)?scratch\.mit\.edu\/projects\/(\d+)/); + const urlMatches = input.match(/^(?:https:\/\/)?scratch\.mit\.edu\/projects\/(\d+)/); if (urlMatches && urlMatches.length > 0) { - return urlMatches[2]; + return urlMatches[1]; } - const projectIdMatches = input.match(/^(#?)(\d+)$/); + const projectIdMatches = input.match(/^#?(\d+)$/); if (projectIdMatches && projectIdMatches.length > 0) { - return projectIdMatches[2]; + return projectIdMatches[1]; } return null; }