Identify a common pattern [duplicate]
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Find common substrings between two character variables 3 answers Is there a (easy) possibility to identify a common pattern which two strings share? Here is a little example to make clear what I mean: I have two variables containing a string. Both include the same pattern ("ABC") and also some "noise". a <- "xxxxxxxxxxxABCxxxxxxxxxxxx" b <- "yyyyyyyyyyyyyyyyyyyyyyyABC" Lets say I don't know the common pattern and I want R to find out that both strings contain "ABC". How can I do this? *edit The first