Php uses regular expressions for string search. Php regular expression string search method this article mainly introduces the php regular expression string search method, the example shows how to use php regular expressions to search strings using regular expressions.
This article mainly introduces php's method of searching strings using regular expressions. The example analyzes the usage skills of php regular expressions, which has some reference value. if you need it, you can refer
This example describes how to search strings using regular expressions in php. Share it with you for your reference. The specific implementation method is as follows:
?
|
1
2
3
4
5
6
7
8
9
10
11 |
$ String_to_search = "jb51.net ";
$ Regex = "/tor /";
$ Num_matches = preg_match ($ regex, $ string_to_search );
If ($ num_matches> 0 ){
Echo "Found a match! ";
} Else {
Echo "No match. Sorry .";
}
?>
|
I hope this article will help you with php programming.
This article describes how to search strings using regular expressions in php. The example shows how to use regular expressions in php...