in reply to Regex to catch IPV4 and IPV6 whenever ip appears withing brackets
If you specifically want to catch IP-addresses in brackets, I would first look for bracketed strings that contain digits, e.g. /(\(.*?0-9.*?\))/g, specifying "non-greedy" so that you get the shortest possible string.and applying this pattern as often as necessary to each input line. For each captured string, apply a Regexp::Common pattern to search for IP-addresses, also applying the pattern multiple times per-string. The check for digits occurring within the brackets is to reduce the number of false-positives on the first match loop.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regex to catch IPV4 and IPV6 whenever ip appears withing brackets
by Anonymous Monk on Jul 10, 2018 at 15:13 UTC | |
by BillKSmith (Monsignor) on Jul 10, 2018 at 20:39 UTC | |
Re^2: Regex to catch IPV4 and IPV6 whenever ip appears withing brackets
by Anonymous Monk on Jul 11, 2018 at 14:03 UTC | |
|
In Section
Seekers of Perl Wisdom