Hello,
I am new to ruby and had a question about parsing text.
I am trying to parse out the first IP address from a string. I have a
working solution, but it seems like a rather round about way to do it.
This is my current method:
str = " inet addr:192.168.1.118 Bcast:192.168.1.255
Mask:255.255.255.0"
ipAddr = ((str.split(':'))[1].split)[0]
Is there a better way to do this? Thanks in advance.
--
Posted via http://www.ruby-forum.com/.