in reply to Re^4: search pattern with digits
in thread search pattern with digits

  1. How is the search string given?
  2. What search string is given?
  3. How the input data vary?
  4. How will what you search for depend on the input data?
  5. Will you always be capturing the same data?

For the example you have given where you always want to capture a number after or before "rows rejected"

qr{(?| \Q$string\E [^\d]* (\d+) | (\d+) [^\d]* \Q$string\E ) }x
will capture the last number before a given search string or if there isn't one the first number after the string. Note given
records processed 23456, total rows rejected 567
it will match 23456.

What is the input when one row is rejected? Is it

1 rows rejected
or
1 row rejected
Know your data;)