अगर URL
पाठ में भाग केवल एक बार मौजूद है, निम्नलिखित कार्य करना चाहिए।
MySQL समाधान:
select concat( @pss:=substring_index( txt, 'http://', 1 ),
substring( @ss:=substring_index( txt, 'http://', -1 ),
if( (@l:=locate( ' ', @ss )) > 0, @l+1, 0 ) )
) as txt
from (
select 'This is a test http://t.co/aBc689XYz' as txt
union all
select 'Have a nice http://t.co/vZ754PlkuI day'
union all
select 'This worked http://sqlfiddle.com/#!2/d41d8 perfectly on sql fiddle'
) records
;
परिणाम :
+-------------------------------------+
| txt |
+-------------------------------------+
| This is a test |
| Have a nice day |
| This worked perfectly on sql fiddle |
+-------------------------------------+
डेमो @ MySQL 5.5.32 Fiddle