code: public Scanner skip(Pattern pattern) {
          ensureOpen();
          if (pattern == null)
              throw new NullPointerException();
          clearCaches();
  
          // Search for the pattern
          while (true) {
              String token = matchPatternInBuffer(pattern);
              if (token != null) {
                  matchValid = true;
                  position = matcher.end();
                  return this;
              }
              if (needInput)
                  readInput();
              else
                  throw new NoSuchElementException();
          }
      }
docs: Skips input that matches the specified pattern, ignoring delimiters.
  This method will skip input if an anchored match of the specified
  pattern succeeds.
  
  <p>If a match to the specified pattern is not found at the
  current position, then no input is skipped and a
  <tt>NoSuchElementException</tt> is thrown.
  
  <p>Since this method seeks to match the specified pattern starting at
  the scanner's current position, patterns that can match a lot of
  input (".*", for example) may cause the scanner to buffer a large
  amount of input.
  
  <p>Note that it is possible to skip something without risking a
  <code>NoSuchElementException</code> by using a pattern that can
  match nothing, e.g., <code>sc.skip("[ \t]*")</code>.
  
  @param pattern a string specifying the pattern to skip over
  @return this scanner
  @throws NoSuchElementException if the specified pattern is not found
  @throws IllegalStateException if this scanner is closed