/// <summary>
        /// Passwords generator using the specified regular expression.
        /// </summary>
        /// <param name="token">CancellationToken to stop string generation.</param>
        private async Task GenerateStrings(CancellationToken token)
        {
            List <string> matches = new List <string>();

            BusyStateManager.EnterBusy();
            BusyStateManager.SetMessage(SeverityType.Info, "Generating strings that match the specified RegEx.");

            await Task.Run(() =>
            {
                int count    = 0;
                string match = null;

                /* Set regular expression and add matches to collection. */
                if (_regExService.SetRegEx(RegEx))
                {
                    while (!token.IsCancellationRequested &&
                           count++ < MaxRows &&
                           (match = _regExService.GetNext()) != null)
                    {
                        matches.Add(match);
                    }
                }
            });

            RegExMatches = new ObservableCollection <string>(matches);

            BusyStateManager.SetMessage(SeverityType.None);
            BusyStateManager.ExitBusy();
        }
        /// <summary>
        /// The GetFirst method returns the first string that meets the regular expression.
        /// Returns null if no string meets the regular expression.
        /// </summary>
        /// <remarks>
        /// The GetFirst method rewinds the RegEx generator.
        /// </remarks>
        public string GetFirst()
        {
            string match = null;

            Count = 0;
            if (_regExService.SetRegEx(RegEx))
            {
                match = _regExService.GetNext();
            }

            if (match != null)
            {
                Count++;
            }

            return(match);
        }