Skip to content
Snippets Groups Projects
Commit eac11510 authored by Karishma Chadha's avatar Karishma Chadha
Browse files

Minor update to regex for url validation.

parent 9f13c9e9
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment