or in your case
(I'm very surprised the \s suggested by David did not work - that's pretty
Essentially this is wrapping the one-or-more whitespaces \s+ with (?>)
which is called Atomic Grouping.
The \s+ is greedy which is to say it will grab as many whitespace
characters as it can and then look at the next part of the expression to
carry on matching (in your case the filea) If that fails to match, it will
backtrack, so if it grabbed 3 spaces, it will drop one and then try to
match and so on until it can't backtrack anymore.
The atomic grouping stops that backtracking process - essentially once it
gets past the closing parenthesis, it throws away all states so it doesn't
go back and try with, say 2 spaces then one space.
Maybe not an issue for you and maybe not supported if not even \s is
supported but it's a good performance thing to be aware of for the
situations where it's obvious that once you've done a greedy match and the
next bit has failed - there is no point in dropping the last character of
the greedy match and retrying the expression again.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.