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