Analysis of PHP regular expression positioning characters. We often encounter the use of PHP regular expressions to locate characters during development. what types of characters does a PHP regular expression have? What exactly do they mean when we use PHP regular expressions to locate characters? what are the types of characters that we often encounter during development? What exactly do they represent? Let's start introducing them one by one.
PHP regular expressions:
A php regular expression is a very important character in a PHP regular expression. it is used to describe the position of a character in a matching object.
The PHP regular expression locates the types and meanings of characters:
◆ ^:
Indicates that the matching mode appears at the beginning of the matching object (different from that in)
◆ $:
Indicates that the matching mode appears at the end of the matching object.
◆ Space:
Indicates that the matched pattern appears at one of the two boundaries at the beginning and end.
◆ "/^ He /":
It can match strings starting with "he", such as hello and height;
◆ "/He $ /":
It can match strings ending with "he", that is, "she;
◆ "/He /":
It starts with a space and matches a string starting with "he", just like ^;
◆ "/He /":
End with a space. it matches the string ending with "he", just like "$;
◆ "/^ He $ /":
It indicates that it only matches the string "he.
The following is a brief introduction to the location of PHP regular expressions. I hope you can understand and understand the location of PHP regular expressions.
Why? What exactly do they represent...