Answer the question
In order to leave comments, you need to log in
Regular expressions and numbered backreferences
Good afternoon.
Regular expressions have such a thing as numbered backreferences.
For example, there is a date
26-4-03 or 26/04/03 or 26.4.3
Using numbered backreferences, this can be written like this:
\b\d{1,2}(\/|\.|\-)\d{ 1,2}\1(\d{1,2))\b
And how can you write a working version of something like this expression?
\b(\d{1,2})(\/|\.|\-)\1\2\1\b
Answer the question
In order to leave comments, you need to log in
ngelik , specifically with backlinks the way you want - you can't.
Are you making things difficult? For simple date parsing, it makes no sense to build complex regular expressions.
Check out this post. You can DEFINE
do something similar with .
Your regular expression looks quite working regexr.com?34mm4
What's wrong with it?
Backreferences substitute the found value, not the pattern. Maybe you are wrong about this?
\b(\d{1,2})(\/|\.|\-)\1\2\1\b
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question