You need to remove the ^
and $
meta-characters then you regex becomes:
order passes (?:quantity |)limits
because when you use ^
the line must start with the word order
and because you used $
the line must end with limits
, the above regex will match your sentence anywhere inside the input string.
or use the following regex:
^Then order passes (?:quantity )?limits$