| 473 | } |
| 474 | |
| 475 | void RegExPredicate::setOptions(const std::string& _options) { |
| 476 | // According to http://docs.mongodb.org/manual/reference/operator/query/regex/ |
| 477 | // Options can be only "i", "x", "m" and "s" |
| 478 | options = pcrecpp::RE_Options(); |
| 479 | options.set_caseless(_options.find('i') != std::string::npos); |
| 480 | options.set_multiline(_options.find('m') != std::string::npos); |
| 481 | options.set_extended(_options.find('x') != std::string::npos); |
| 482 | options.set_dotall(_options.find('s') != std::string::npos); |
| 483 | |
| 484 | const auto& pattern = re->pattern(); |
| 485 | re.reset(new pcrecpp::RE(pattern, options)); |
| 486 | |
| 487 | // we need to recalculate this after each change of options |
| 488 | calculateRange(); |
| 489 | } |
| 490 | |
| 491 | Future<bool> RegExPredicate::evaluate(const Reference<IReadContext>& context) { |
| 492 | Future<DataValue> fdv = getMaybeRecursive(context, StringRef()); |
no test coverage detected