0
votes

Consider the following set:

2017.16, 2017.16.a, 2017.16.b, 2017.167

I am trying to use a regular expression to search my azure index and return: 2017.16.a, 2017.16.b

using the following as my query:

accession_number:/2017\.16\.*/

returns three documents: 2017.16, 2017.16.a, 2017.16.b

How can I change the regular expression to only include the .a and .b records?

1

1 Answers

1
votes

Assuming this field is not "searchable", you're getting this match because the end of the regex ("16.*") matches anything that ends in 16 followed by zero or more (including multiple) periods. If you want to only include exactly "a" or "b" as suffixes, you could use:

/2017\.16\.(a|b)/

If you want to allow exactly 1 more character, any character:

/2017\.16\../