Wishing to put some order into my knowledge of regular expressions I decided to go through a book about them, Introducing Regular Expressions. And I know it's silly but one of the introductory examples doesn't make sense to me.
(d)d1
Sample text:
123-456-7890
(should capture the first number, 123
)
Can anyone explain what is going on in here?
As far as I can figure out, the first d
captures the number 123. The 1
backreferences (marks) the group for later use. The parenthesis limit the scope of the group. But what does the second d
does?
Simple explanation, like to a small child or a golden retriever are prefered.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…