From ba87721e959af800af8f48e8633339e7d359e93f Mon Sep 17 00:00:00 2001 From: Stephen Steneker Date: Tue, 8 Jan 2013 10:21:15 +1100 Subject: [PATCH] DOCS-958: Clarification on $regex use of indexes --- source/reference/operator/regex.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/reference/operator/regex.txt b/source/reference/operator/regex.txt index adff0693e0b..57820347dec 100644 --- a/source/reference/operator/regex.txt +++ b/source/reference/operator/regex.txt @@ -73,10 +73,11 @@ $regex ``collection`` that match the case insensitive regular expression ``acme.*corp`` that *don't* match ``acmeblahcorp``. - :operator:`$regex` uses :term:`indexes ` only when the - regular expression has an anchor for the beginning (i.e. ``^``) - of a string. Additionally, while ``/^a/``, ``/^a.*/``, and - ``/^a.*$/`` are equivalent, they have different performance - characteristics. All of these expressions use an index if an - appropriate index exists; however, ``/^a.*/``, and ``/^a.*$/`` - are slower. ``/^a/`` can stop scanning after matching the prefix. + :operator:`$regex` can only use an :term:`index ` efficiently + when the regular expression has an anchor for the beginning (i.e. ``^``) + of a string and is a case-sensitive match. Additionally, while + ``/^a/``, ``/^a.*/``, and ``/^a.*$/`` match equivalent strings, they + have different performance characteristics. All of these expressions + use an index if an appropriate index exists; however, ``/^a.*/``, + and ``/^a.*$/`` are slower. ``/^a/`` can stop scanning after matching + the prefix.