I need to search a table and return only the IP addresses found within a text field. (Yes, the IP address should have been saved in its own column but this isn't the case unfortunately.)
I'm hoping to group the data by the amount of times the IP address occurs.
Using this SQL,
SELECT * FROM `table` WHERE `column` LIKE '%somevalue%' AND `text_column` REGEXP '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}'
On a column as such,
+----------------------+------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+------------------+------+-----+---------------------+----------------+
{snip}
| text_column | text | YES | | NULL | |
{snip}
+----------------------+------------------+------+-----+---------------------+----------------+
Where text_column can contain entire paragraphs or sentences like,
Hello, my IP address is: 0.0.0.0
How can I return data to only show the IP address contained within text_column such as,
COUNT(*) text
143 127.0.0.1
84 192.168.0.100
2 255.255.255.0
Thanks for your help.