I need to ignore a '.' at the start of my regular expression, and have been somewhat stumped.
My current regex is:
(?::)(\d{3})
Which matches the following:
When I try to ignore the '.' with the following regex:
[^.](?::)(\d{3})
I get this:
As it seems to be adding the extra character like '<', which is unwanted.
How do I go about to ignore that extra character in front of the ':' ?
Use this alternation based regex:
\.:\d{3}|:(\d{3})
And grab captured group #1 for your matches.
Just use a lookahead to match the strings in this :\\d{3}
format preceded by any but not of dot.
(?=[^.](:(\d{3})))
Group 1 contains the string with :
, and the group 2 contains only the digits.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.