Topic: Some RegEx Help with IP and email

Hi, I have read a load of IPs from a file but they are stuck with some dashes and spaces before and after the IP, is there a regexp that would allow me to trim everything off before the first number [0-9] and chop everything after the last number?

Also, I have a list of email adresses, including some from my own domain, how can I match the ones from my domain and remove them from the list? The list is actually an array of simple objects with the email being one of the objects fields.

I would be really grateful for anyone who could point me in the right direction with either of these problems, thanks.

Last edited by ucknose (2011-02-09 16:07:53)

Re: Some RegEx Help with IP and email

Per your email question ...

# collection should be an array  
collection.delete_if { |x| x.email =~ /@domain\.com/i }