Add negated regular expressions for views filters (string and integer)

Created on 16 February 2017, almost 8 years ago
Updated 6 July 2023, over 1 year ago

Problem/Motivation

Usecase:
There are three nodes with the following titles: foo, bar, drupal. Requirement: Create a view that lists nodes that does not have title foo or bar.

Using views string filter you can't create a SQL expression like "some_field NOT IN ('foo', 'bar')", as a workaround when searching a multiple value string in a string Regular Expression operation can be chosen but it's hard to implement a reverse search for regex because the regex is done on SQL level which is limited according to https://dev.mysql.com/doc/refman/5.7/en/regexp.html

POSIX regexes don't support using the question mark ? as a non-greedy (lazy) modifier to the star and plus quantifiers like PCRE (Perl Compatible Regular Expressions). This means you can't use +? and *?

http://stackoverflow.com/questions/18317183/1139-got-error-repetition-op...

Proposed resolution

Implement negation for REGEXP operation, it can be found in documentation as NOT REGEXP.

NOT REGEXP Negation of REGEXP

https://dev.mysql.com/doc/refman/5.7/en/regexp.html

Remaining tasks

User interface changes

Adds a new "Negated Regular expression" option to the choices for the operation to use for Views string and integer filters.

API changes

None.

Data model changes

None.

Feature request
Status

Fixed

Version

11.0 🔥

Component
Views 

Last updated about 5 hours ago

Created by

🇲🇩Moldova surfinspirit

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024