我想在第三个括号内加入字符串[]

时间:2016-08-02 09:20:45

标签: mysql string

我有一个像

这样的字符串
"Email Request processed successfully Emails:[xyz.abc@qubee.com.bd][HostName 
 =WSRC-AFFILIATE-1, Host Address = 192.168.103.105]" 

如何在mysql中获取"xyz.abc@qubee.com.bd"

1 个答案:

答案 0 :(得分:1)

如果模式相同,则可以执行

mysql> select 
 substring_index(
     substring_index('"Email Request processed successfully Emails:[xyz.abc@qubee.com.bd][HostName = WSRC-AFFILIATE-1, Host Address = 192.168.103.105]"',
    'Emails:[',-1
     ),
']',1) as s ;


+----------------------+
| s                    |
+----------------------+
| xyz.abc@qubee.com.bd |
+----------------------+