需求:
The regex pattern can be found中的regex pattern
方法:
1. Python
a. Global function
import re
if re.search("regex pattern",subject):
print "Match Pass!"
else:
print "Match Fail!"
b. Compiled object
import re
reobj = re.compile("regex pattern")
if reobj.search(subject):
print "Match Pass!"
else:
print "Match Fail!"
2. Tcl
set result [regexp -linestop {regexp pattern} $subject]
if {$result == 1} {
puts "Match Pass!"
} else {
puts "Match Fail!"
}