B
Bob
I have numbers I am trying to match, for example:
input = "1.2.3.4"
pattern = @"\d+\.\d+\.\d+\.\d+"
But the problem is, three of them are optional and it is important which
ones get matched. The numbers need to be matched like this:
c
c.d
a.c.d
a.b.c.d
I can get close with this pattern:
pattern = @"(((?<a>\d+)\.)?(?<b>\d+)\.)?(?<c>\d+)(\.(?<d>\d+))?"
But I can't seem to figure out how to make 'd' a higher priority than 'a'
and 'b, because with "2.3.4" it is matching a.b.c instead of a.c.d.
Any input would be appreciated...
input = "1.2.3.4"
pattern = @"\d+\.\d+\.\d+\.\d+"
But the problem is, three of them are optional and it is important which
ones get matched. The numbers need to be matched like this:
c
c.d
a.c.d
a.b.c.d
I can get close with this pattern:
pattern = @"(((?<a>\d+)\.)?(?<b>\d+)\.)?(?<c>\d+)(\.(?<d>\d+))?"
But I can't seem to figure out how to make 'd' a higher priority than 'a'
and 'b, because with "2.3.4" it is matching a.b.c instead of a.c.d.
Any input would be appreciated...