In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.