title: Find a sequence of character in a String
body: <p>I need to find a sequence of characters (in this case ffg) in a String, and when find the sequence return the character that comes before and after.</p>
  
  <p>I manage to find this way using match.find(), but it return the position and I need the character that is stored there.</p>
  
  <p>this output is :</p>
  
  <pre><code>16 ffg 20
  34 ffg 38
  47 ffg 51
  60 ffg 64
  </code></pre>
  
  <p>and I need:</p>
  
  <pre><code>g ffg k
  d ffg k
  </code></pre>
  
  <p>Code follows:</p>
  
  <pre><code>import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  public class Testes {
  
  public static void main(String[]args){
  
          String text = "aaddbsanklfafjdkgffgkakfjkldsjlkfjdffgkaskdlfkdkffgasjdaeflkaffgaff";
  
          String wordToFind = "ffg";
  
  
          Pattern word = Pattern.compile(wordToFind);
          Matcher match = word.matcher(text);
  
          while (match.find()) {
  
               System.out.print(match.start() - 1);
               System.out.print(" " + wordToFind + " ");
               System.out.println(match.end());
  
          }
  
      }
  }
  </code></pre>