In the PP file for writing puppet, many of the regular expressions for Ruby are used and are commonly used as follows:
Regular expression:
[Codesyntax lang= "Ruby"]
{}: The number of repetitions (such as {4} indicates that the preceding repeat occurs exactly 4 times)
{m,n}: The preceding element appears at least m times, with a maximum of n times
[]: A range descriptor, such as a letter in a-Z range (for example, [A-z])
\w: Character or number, equivalent to [ 0-9a-za-z]
\w: Non-alphabetic or numeric
\s: [\t\n\r\f] null character, equivalent to [\t\n\r\f]
\s: non-null character
\d: [0-9] number, equivalent to [0-9]
\d: non-numeric characters
*: The preceding element appears 0 or more times
+: The preceding element appears 1 or more times
?: The preceding element appears up to 1 times
|: Matches the preceding or following expression
\b: Backspace (0x08) (only when the range descriptor is inside)
\b: Word boundary (word boundary)
\b: Non-word boundaries (when outside the range descriptor)
instance: [Codesyntax lang= "Ruby"]
=begin nonnegative
Integer (Positive integer +0): ^\d+$
positive integer: ^[0-9]*[1-9][0-9]*$
non positive integer (negative integer +0): ^ (-\d+) | ( 0+) $
26-letter string: ^[a-za-z]+$ a
string of numbers and 26 English letters: ^[a-za-z0-9]+$
e-mail address: ^[\w-]+ (\.[ \w-]+) *@[\w-]+ (\.[ \w-]+) +$
year-month-day:
Chinese characters: [\u4e00-\u9fa5]
double-byte characters (including Chinese characters): [^\x00-\xff]
HTML Tags:/<.*>.*<\/\1 >|<.*>\/>/
Account is legal (beginning of letter, allow 5-16 bytes, allow alphanumeric underline): ^[a-za-z][a-za-z0-9_]{4,15}$
phone number: (\d{3}-|\d {4}-)? (\d{8}|\d{7})?
Tencent QQ Number: ^[1-9]*[1-9][0-9]*$
Thank you for reading, I hope to help you, thank you for your support for this site!