Why does this rule not match the following string?

var str = "https://23.segment.com/?usename=David";
var pattern = /^(http|https|ftp|mailto):\/\/[0-9a-z\.]+([\/0-9a-z]|[-\_\?=])*([\.a-z]*)$/
console.log(pattern.exec(str));//null

Why doesn"t the above regular match come out? ask God for advice

Mar.22,2021

recommend a online test regular website
remember to select JavaScript .
you can delete the latter first. Analyze it one by one.

at first glance, the string obviously has a David . There is no match for capital letters in the rule, so of course it doesn't.
you can match with a simple change.

^(http|https|ftp|mailto):\/\/[0-9a-z\.]+([\/0-9a-z]|[-\_\?=])*([\.a-zA-Z]*)$

https://regex101.com/
try it yourself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e91b26-1378.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e91b26-1378.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?