Spaces:
Sleeping
Sleeping
File size: 494 Bytes
7aec436 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
export const extractProjectId = (text) => {
const match = text.match(/\d+/);
if (!match) {
return '';
}
return match[0];
};
export const isValidURL = (str) => {
try {
const url = new URL(str);
return url.protocol === 'http:' || url.protocol === 'https:';
} catch (e) {
return false;
}
};
export const getTitleFromURL = (url) => {
const match = url.match(/\/([^\/]+)\.sb[2|3]?$/);
if (match) {
return match[1];
}
return '';
};
|