Maybe someone knows or remembers how you can put a filter on input?
Wdym? Like prevent html code or something?
Well, here I entered the number 1 in input, but there should be a number from 100 for example, so that it says that the data is not correct.
I did not understand that
Well look. I have a input for entering a link. I enter ‘rwegreer’ and it tells me that the data entered is incorrect. And when I enter ‘http://’ or ‘https://’ it says nothing.
So you want to check if the URL is a valid URL?
Yes, that’s what I need.
const isUrl = uri => /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/gi.test(uri);
Usage:
console.log(isUri("https://google.com")); // true
1 Like
https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation min
and pattern
etc