Re: Extract text from string
2012/10/12 17:56 +0100, Neil Tompkins Is there such a way in a MySQL query to extract the text this is a test from the following strings as a example stronga href=http://www.domain.com/; class=linkthis is a test/a/strong stronga href=http://www.domain.com/; title=this is a test class=linklink/a/strong Amongst the built-in functions there isn't much; for the former example, if the string is s, this works: SUBSTRING_INDEX(SUBSTRING_INDEX(s, '', -3), '', 1) ; for the latter, if t: SUBSTRING_INDEX(SUBSTRING_INDEX(t, '', -4), '', 1) . If you want a real HTML parser that discards everything but arbitrary strings, you have to get install your own. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Extract text from string
Hi, Is there such a way in a MySQL query to extract the text this is a test from the following strings as a example stronga href=http://www.domain.com/; class=linkthis is a test/a/strong stronga href=http://www.domain.com/; title=this is a test class=linklink/a/strong Thanks Neil
RE: Extract text from string
No. Or if there is, it is too ugly to contemplate. You are better off doing such in a real programming language. MySQL will locate row(s) containing this is a test via LIKE, RLIKE, or FULLTEXT (with caveats). You need to take over from there. -Original Message- From: Neil Tompkins [mailto:neil.tompk...@googlemail.com] Sent: Friday, October 12, 2012 9:56 AM To: [MySQL] Subject: Extract text from string Hi, Is there such a way in a MySQL query to extract the text this is a test from the following strings as a example stronga href=http://www.domain.com/; class=linkthis is a test/a/strong stronga href=http://www.domain.com/; title=this is a test class=linklink/a/strong Thanks Neil -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: Extract text from string
Of course... There's many libraries for REGEX which you can use, link it with an UDF and boom! http://dev.mysql.com/doc/refman/5.1/en/adding-udf.html S On Fri, Oct 12, 2012 at 12:56 PM, Neil Tompkins neil.tompk...@googlemail.com wrote: Hi, Is there such a way in a MySQL query to extract the text this is a test from the following strings as a example stronga href=http://www.domain.com/; class=linkthis is a test/a/strong stronga href=http://www.domain.com/; title=this is a test class=linklink/a/strong Thanks Neil