The ruby regular expression is a Regexp class object.
Main metacharacters
Sn |
Meaning |
Example |
Xiaoming |
^ |
Header |
/^ ABC/ |
ABC begin |
$ |
End of line |
/ABC $/ |
ABC too many rows |
. |
Any limit 1 Text |
/A. B/ |
A between B between 1 Text |
[...] |
[] Inner limit 1 Text |
/[A-Za-Z]/ |
English |
[^...] |
[] The inner vertex contains the inner vertex 1 text. |
/[^ 0-9]/ |
Not a number |
* |
0 or more |
/.*/ |
A worker starts worker |
+ |
1 or more |
/A +/ |
1 or more times |
? |
0-back rollback-1-back |
/AA? / |
A few minutes without AA |
A | B |
A worker B |
/^ (ABC) | (ABC) $/ |
ABC too many ABC too rows |
(...) |
Zookeeper regionalization |
/(ABC) +/ |
When ABC returns a response, more than one response is returned. |
\ W |
English digit comment _ |
/^ \ W + $/ |
English digit comment _ blank Comment comment row |
\ W |
Outside of the English digit limit _ |
/Hello, \ Wworld/ |
Hello, there is a world outside the English number comment _ 1 Text |
\ S |
Blank text |
/Hello, \ sworld/ |
Hello, please world blank text |
\ S |
Other than blank text |
/Hello \ sworld/ |
Hello, there is no space for reading 1 Text |
\ D |
Number |
/A \ D/ |
A branch number 1 Text |
\ D |
Not a number |
/A \ D/ |
A: 1 text not included in the number |
The result is as follows: