title: How to grab substring after a specific word in java
body: <p>I'm creating an IRC bot that grabs Twitter links and sends the text to the channel. This is my code:</p>
  
  <pre><code>if (messageIC.contains("https://twitter.com/") &amp;&amp; messageIC.contains("/status/")) {
      try {
          String tweeter = message.substring(20);
          String[] tweety = tweeter.split(" ");
          String tweety1 = tweety[0];
          String url = "https://twitter.com/" + tweety1;
          Document doc = Jsoup.connect(url).get();
          Element tweetText = doc.select("p.js-tweet-text.tweet-text").first();
          sendMessage(channel, "Twitter: " + tweetText.text());
      } catch (IOException ex) {
          Logger.getLogger(Ampersand.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  </code></pre>
  
  <p>This works if the user sends only the link or even if the user types something out after the link. But it doesn't work if the user types something before the link, for example, "blahblahblah <a href="http://www.twitter.com/user/status/xxxx" rel="nofollow">http://www.twitter.com/user/status/xxxx</a>" since it will start grabbing immediately and not after twitter.com.</p>
  
  <p>Is there a way to only grab the substring after twitter.com?</p>