I've been working on some Drupal filters to snag some HTML tags and do certain things with them. Here's the PREG function from hell that actually does most of the work. It basically takes any properly formed HTML tag and splits it into attributes. I'll come back and document this later, but I had to show off this code from hell... :)
It actually could be cleaned up a bit, but I'll deal with that later when I'm actually awake. more...
I wanted to split up an IP address in BASH so I could use it in my pppd ip-up script to check for a certain DNS server. Because the DNS server itself seemed to change a lot, I just wanted to check on the first three quads.
Assuming the IP address comes in on $DNS1 (as it does in /etc/ppp/ip-up):
1 2 | DNSIP=(${DNS1//./ }); #IPADDRESS=${DNSIP[0]}.${DNSIP[1]}.${DNSIP[2]}.${DNSIP[3]} |