code: public static Track1FormatB from(final String rawTrackData)
    {
      final Matcher matcher = track1FormatBPattern
        .matcher(trimToEmpty(rawTrackData));
  
      final String rawTrack1Data;
      final AccountNumber pan;
      final ExpirationDate expirationDate;
      final Name name;
      final ServiceCode serviceCode;
      final String formatCode;
      final String discretionaryData;
  
      if (matcher.matches())
      {
        rawTrack1Data = getGroup(matcher, 1);
        formatCode = getGroup(matcher, 2);
        pan = new AccountNumber(getGroup(matcher, 3));
        name = new Name(getGroup(matcher, 4));
        expirationDate = new ExpirationDate(getGroup(matcher, 5));
        serviceCode = new ServiceCode(getGroup(matcher, 6));
        discretionaryData = getGroup(matcher, 7);
      }
      else
      {
        rawTrack1Data = null;
        formatCode = "";
        pan = new AccountNumber();
        name = new Name();
        expirationDate = new ExpirationDate();
        serviceCode = new ServiceCode();
        discretionaryData = "";
      }
  
      return new Track1FormatB(rawTrack1Data,
                               pan,
                               expirationDate,
                               name,
                               serviceCode,
                               formatCode,
                               discretionaryData);
    }
docs: Parses magnetic track 1 format B data into a Track1FormatB object.
  
  @param rawTrackData
  Raw track data as a string. Can include newlines, and other
  tracks as well.
  @return A Track1FormatB instance, corresponding to the parsed data.