I am pulling unstructured data from a source and I am trying to put in structured from in DB. To minimize the amount of overhead by bombarding my server with multiple queries, i was wondering if there is a way to do a complex query that: Searches a string for a regex pattern say A[0-9]G+ and add a new row in another table where row.column = found column from regex
-
4You might want to provide some more info. Such as an example of your data and an example of the output you expect.ChrisLively– ChrisLively2011-07-04 20:31:18 +00:00Commented Jul 4, 2011 at 20:31
-
I guess what I really want is to SELECT the regex substrings from a column (there may be multiple). For example: User1 says Hey check out #hashtag1 #hashtag2 #hashtag3, i want 3 row returned: (user1,hashtag1) (user1,hashtag2), (user1,hashtag3)user805547– user8055472011-07-05 14:08:10 +00:00Commented Jul 5, 2011 at 14:08
-
Also you might want to state exactly how the data is getting to your MySql server. There might be better options than running regex in the database itself.ChrisLively– ChrisLively2011-07-05 14:56:49 +00:00Commented Jul 5, 2011 at 14:56
Add a comment
|
1 Answer
MySQL has an INSERT-SELECT statement that lets you combined a selection (as complex as you want, including regex) with an insertion into a table of whatever was selected.
http://dev.mysql.com/doc/refman/5.5/en/ansi-diff-select-into-table.html