简体   繁体   English

在mysql中查找特定子字符串后面的字符串

[英]Find the string after a specific substring in mysql

I want to retrieve the last part of a large string in mysql after occurence of a particular substring. 我想在发生特定子字符串后检索mysql中大字符串的最后一部分。 Please advice about how to do that. 请告知如何做到这一点。

For eg the main string contains "New Delhi is capitalof India". 例如,主要字符串包含“新德里是印度之都”。 "Berlin is capitalof Germany". “柏林是德国的首都”。

I need to retrieve only India and Germany. 我只需要检索印度和德国。 I want know how to retrieve the data occuring after the specific substring like 'capitalof'. 我想知道如何检索特定子字符串之后发生的数据,如'capitalof'。

I need to do this in mysql. 我需要在mysql中执行此操作。

You can use substring_index 您可以使用substring_index

select
substring_index(title,'capitalof',-1)
from table1

DEMO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM