diff options
Diffstat (limited to 'gui/src/logic/constants.ts')
| -rw-r--r-- | gui/src/logic/constants.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gui/src/logic/constants.ts b/gui/src/logic/constants.ts index fcf5573..a1569fd 100644 --- a/gui/src/logic/constants.ts +++ b/gui/src/logic/constants.ts @@ -25,9 +25,19 @@ export const REF_REGEX = new RegExp( ); export const RADIO_REGEX = new RegExp(/urbit:\/\/radio\/~[a-z-_]+/gim); +// export const URL_REGEX = new RegExp( +// /^(https?:\/\/)?((localhost)|([\w-]+(\.[\w-]+)+)|(\d{1,3}(\.\d{1,3}){3}))(:\d{2,5})?(\/[^\s?#]*)?(\?[^#\s]*)?(#[^\s]*)?$/gim, +// ); +export const URL_REGEX = new RegExp( + /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi, +); export const IMAGE_REGEX = new RegExp( - /https:\/\/.+\.(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)\b/gim, + /https:\/\/.+\.(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)\b/gi, +); +export const IMAGE_SUBREGEX = new RegExp( + /.*(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)$/, ); +export const VIDEO_SUBREGEX = new RegExp(/.*(mov|mp4|ogv|mkv|m3uv)$/); export const SHIP_REGEX = new RegExp(/\B~[a-z-]+/); export const HASHTAGS_REGEX = new RegExp(/#[a-z-]+/g); |
