too long

I have a column in mysql with a mix of IP addresses and email addresses. Is there a MySQL function that can identify a string as an ip address?

If not, what other methods would you recommend?

Regards

J

You can use REGEXP in mysql query

so to select only ip addresses from column you can write

select * from tableName where columnname REGEXP '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$';

example

select * from value1 where newValue REGEXP '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$';

As emails have to contain a "@" and IPs can't, you could select them like this:

select c from t where c not like '%@%';

Use LOCATE function. This SELECT will bring everything that doesn't have an @.

SELECT * FROM table WHERE LOCATE ('@', field)=0;