In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to implement regular expressions that allow URL to allow only a few characters. I hope you will get something after reading this article. Let's discuss it together.
For example, the restriction allows only the following regularities
AWhat Z
0-9
Http:// matching coherence
Https:// matching coherence
Can not appear two times in a row
&
%
? Can not appear two in a row
= equal sign
-Center dash
_ underline
. Point is very important.
As follows, the rule is consistent with
^ ((?: http | https): / /)? ((?! [/?] {2,}) [a-zA-Z0-9\ -. _% & = /?]) + $
RegexBuddy3 translation tool
^ ((?: http | https): / /)? ((?! [/?] {2,}) [a-zA-Z0-9\ -. _% & = /?]) + $
The assertion is at the beginning of the string
Reverse reference 1
◦ repeat 0 to 1 times, match as many as possible (greedy)
◦ matches with the following regular expression
■ matches with the following regular expression (instead of the next regular expression when this regular expression fails)
■ matches the character "http"
■ matches with the following regular expression (this regular expression matching fails, this set does not match)
■ matches the character "https"
◦ matches the character ": / /"
Reverse citation 2
◦ repeats 1 to unlimited times, matching as many as possible (greedy)
◦ Note: you refer back to yourself again. The match will be referenced by the last reverse reference. Iterate the repeated reverse references.
◦ negative forward View
■ matches a character "/?" that appears in the list below.
■ Between 2 and unlimited times, as many times as possible, giving back as needed (greedy)
◦ matches a character that appears in the list below
■ A character that ranges from a to z
■ a character whose range is between An and Z
■ a character with a range of 0 to 9
■ character "-"
One character of ■ is ". _% & = /?" One of them.
The assertion is at the end of the string
After reading this article, I believe you have a certain understanding of "how to make URL allow only some characters of regular expressions". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.