O
O
Optimus2018-03-11 11:02:59
PHP
Optimus, 2018-03-11 11:02:59

What is an unanchored pattern in a regular expression?

In the php.net/manual/ru/reference.pcre.pattern.modifiers.php dock, they write about the S modifier:
If this modifier is used, an additional analysis of the pattern is carried out. Currently, this only makes sense for "unanchored" patterns that do not start with any particular character.
Q:
Any pattern starting with [az] is considered unanchored? Unlike 0[az]?
The description of the modifier A is also unclear for the same reason:
A (PCRE_ANCHORED)
If this modifier is used, the pattern will be matched only if it is "anchored", that is, it matches the beginning of the string in which the search is performed.
Is there any example of its use? Is the beginning of the string absolute? After all, if we use m, we can have many beginnings of lines ... Or will A never work on [az] because there is no specific character at the beginning here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question