metacharacters relation to match:
*:0-multi
+:1-multi
?:0-1
{n},{n,m},{n,}:the number of matching
string switch
eg: pattern="lynn|coco"
src1="hello,my name is lynn"
result1="lynn"
src2="hello,my name is coco"
result2="coco"
ignore case
eg:pattern="(?i)Lynn"
src="hello,my name is lynn"
result="lynn"
multi-repeat-character
eg:pattern="n{2}"
src="hello,my name is lynn"
result="nn"
digital match
eg:pattern="\d+"
src="I am 24 years old but 18 years in school"
result="24","18"
eg:pattern="[0-9]+"
src="I am 24 years old but 18 years in school"
result="24","18"
optional character match
eg:pattern="colou?r"
src1="color" result=color
src2="colour" result=colour
RE0509
时间: 2024-10-11 20:58:06