Mysql
 sql >> डेटाबेस >  >> RDS >> Mysql

टेक्स्ट स्ट्रिंग से वेब पता हटाएं

अगर URL पाठ में भाग केवल एक बार मौजूद है, निम्नलिखित कार्य करना चाहिए।

MySQL समाधान:

select concat( @pss:=substring_index( txt, 'https://', 1 ), 
               substring( @ss:=substring_index( txt, 'https://', -1 ), 
                          if( (@l:=locate( ' ', @ss )) > 0, @l+1, 0 ) ) 
       ) as txt
from (
  select 'This is a test https://t.co/aBc689XYz' as txt
  union all
  select 'Have a nice https://t.co/vZ754PlkuI day'
  union all
  select 'This worked https://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




  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. MySQL SQRT () फ़ंक्शन - MySQL में किसी संख्या का वर्गमूल लौटाएं

  2. Google मानचित्र PHP का उपयोग करके बहुभुज और बिंदुओं को MySQL में सहेजें

  3. क्या एक MySQL दृश्य सामान्य क्वेरी से तेज़ है?

  4. डेटा MySQL डेटाबेस में दो बार सहेजा गया। पता नहीं मैं क्या गलत करता हूँ?

  5. MySQL:अन्य डेटाटाइम फ़ील्ड में डेटाटाइम डालें