We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Links and Url validator error! | Forum

Ken
Ken May 6 '20
I’m getting Url validator error! no matter how I input the link I know the validator.php file is where to start but I tried many regex patterns and still getting this error can someone help please
Chris_W
Chris_W May 7 '20
The URL in your attached image only shows the domain name. Have you tried entering the URL with its full http or https prefix?
The Forum post is edited by Chris_W May 7 '20
Ken
Ken May 7 '20
Yes I tried and https not
Marcus
Marcus May 7 '20
share snap shot of the console please? its js conflict 
The Forum post is edited by Marcus May 7 '20
Marcus
Marcus May 7 '20
plus i see its pluging that you use. this means custom validator. thus find regex and replace with UTIL_Validator::URL_PATTERN
The Forum post is edited by Marcus May 7 '20
Ken
Ken May 7 '20



What exactly I do replace ???
When I replace URL_PATTERN with UTIL_Validator I get errors only when access the add new form page 




The Forum post is edited by Ken May 7 '20
Ken
Ken May 7 '20
this my current regex:



const URL_PATTERN = '/^(http(s)?:\/\/)?((\d+\.\d+\.\d+\.\d+)|(([\w-]+\.)+([a-z,A-Z][\w-]*)))(:[1-9][0-9]*)?(\/?([\w-.\,\/:%+@&*=~]+[\w- \,.\/?:%+@&=*|]*)?)?(#(.*))?$/';

The Forum post is edited by Ken May 7 '20
Norias
Norias May 8 '20

If you are using php 7.3, you have to escape the hyphen


Php 7.3 is using PCRE2, so now the hyphen needs to be escaped in regex patterns.


preg_match('/[\w-.]+/', ''); // this will not work in PHP7.3 

preg_match('/[\w\-.]+/', ''); // the hyphen need to be escaped



new regex with hyphen escaped :


const URL_PATTERN = '/^(http(s)?:\/\/)?((\d+\.\d+\.\d+\.\d+)|(([\w\-]+\.)+([a-z,A-Z][\w\-]*)))(:[1-9][0-9]*)?(\/?([\w\-.\,\/:%+@&*=~]+[\w\- \,.\/?:%+@&=*|]*)?)?(#(.*))?$/';



Ken
Ken May 8 '20
Holy Smokes!! it works! thanks 100 but how you knew it was the php version and how u knew which php version Im using and the right regex u sure know your stuff I was going to deactivate this plugin but now I can consider it and because of this I can use the url validation on all my other url inputs instead of text thanks again but where do I find of list of php versions comparison php version just keeps coming up not really giving a difference from the other and developers would have to experience the hardships before understanding which php version is best I run multiple site under one umbrella so my WordPress sites keeps asking to upgrade to the latest php version due to security yet when this is done all site under that umbrella will have the same php version I had tried using php 7.4 but then my oxwall site emails stop sending completely so 7.3 seems stable until now I’m wondering what else I need to configure for 7.3
The Forum post is edited by Ken May 8 '20
Norias
Norias May 11 '20
I didn't know, it's why i said "if" ;)


I had a problem like yours but with a rss widget, and found this solution.


Core can work with php7.3+ with littles changes and with upgrade of vendors and libraries.


There is more work on third party plugins.

Brittany Kosin
Brittany Kosin Jul 13 '21
where can I find the edits