I’d do that at index time. Add an update request processor script that
does the regex and adds a field has_credit_card_number:true.

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Jul 28, 2020, at 11:50 AM, lstusr 5u93n4 <lstusr...@gmail.com> wrote:
> 
> Let's say I have a text field that's been indexed with the standard
> tokenizer, and I want to match the docs that have credit card numbers in
> them (this is for altruistic purposes, not nefarious ones!). What's the
> best way to build a search that will do this?
> 
> Searching for "???? ???? ???? ????" seems to return inconsistent results.
> 
> Maybe a regex search? "[0-9]{4}?[0-9]{4}?[0-9]{4}?[0-9]{4}" seems like it
> should work, but that's not matching the docs I think it should either...
> 
> Any suggestions?
> 
> Thanks In Advance!

Reply via email to