Article 57BE7 RegEx is not matching

RegEx is not matching

by
blason
from LinuxQuestions.org on (#57BE7)
Hi there,

Can someone please help me on regex pattern matching with my below function?

This is matching IPv4 addresses but somehow my IPv6 addresses are not getting matched

Code:212.129.46.32
213.163.64.208
217.61.0.97
223.5.5.5
223.6.6.6
2001:1398:1:0:200:1:123:46
2001:19f0:5:6012:5400:2ff:fe60:7579
2001:19f0:5801:b7c::1
2001:19f0:6401:b3d:5400:2ff:fe5a:fb9fCode:function convert {
while read ip; do
if ! [[ "$ip" =~ [^0-9.-] ]];
then
todo[$y]+=" $ip $ip"
if [ $z -eq 2000 ]
then
z=0
let y=$y+1
else
let z=$z+1
fi
fi
done

dynamic_objects -do ti_$type
dynamic_objects -n ti_$type

for i in "${todo[@]}" ;
do
dynamic_objects -o ti_$type -r $i -a
done
}latest?d=yIl2AUoC8zA latest?i=-EghQQCsrRo:hrkixmpw580:F7zBnMy latest?i=-EghQQCsrRo:hrkixmpw580:V_sGLiP latest?d=qj6IDK7rITs latest?i=-EghQQCsrRo:hrkixmpw580:gIN9vFw-EghQQCsrRo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments