title: Identify a common pattern
body: <p>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: </p>
  
  <p>I have two variables containing a string. Both include the same pattern ("ABC") and also some "noise". </p>
  
  <pre><code>a &lt;- "xxxxxxxxxxxABCxxxxxxxxxxxx"
  b &lt;- "yyyyyyyyyyyyyyyyyyyyyyyABC"
  </code></pre>
  
  <p>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? </p>
  
  <p>*edit</p>
  
  <p>The first  example was maybe a bit to simplistic. Here is a example from my real data.</p>
  
  <pre><code>a &lt;- "DUISBURG-HAMBORNS"
  b &lt;- "DUISBURG (-31.7.29)S"
  </code></pre>
  
  <p>Both strings contain "DUISBURG" which I want the function to identify. </p>
  
  <p>*edit</p>
  
  <p>I took the solution proposed in the link posted in the comments. But I still have not exactly what I want.</p>
  
  <pre><code>library(qualV)
  LCS(strsplit(a[1], '')[[1]],strsplit(b[1], '')[[1]])$LCS
  
  [1] "D" "U" "I" "S" "B" "U" "R" "G" "-" " " " " "S"
  </code></pre>
  
  <p>If the function is looking for the longest common subsequence of the two vectors, why does it not stop after <code>"D" "U" "I" "S" "B" "U" "R" "G"</code>? . </p>