To know about any order regular expression, I decided to go through a book about them, Regular introduction . And I know that it is silly but I do not understand one of the introductory examples.
(\ d) \ d \ 1
sample text:
123-456-7890
(should be occupied by the first number, 123
)
Can anyone say what is happening here?
As far as I can understand, the first \ d
occupies the number 123. For later use, the group backfruit (points) limits the brackets group's scope. But what else does \ d
do?
Simple explanation, like a small child or a golden dog.
<
matches string "123-456-7890" but this is "323 "
(which can be part of a larger string, for example " 323- first digit ("3") \ d: second digit ("2") \ 1: The first group (which was "3")
Now, if your book shows that (\ d) \ d \ 1 \ / code> is passed to "123"
should be Captured "123-456-7890"
, then there may be an error ...
Comments
Post a Comment