diff options
author | Alexandre Alapetite <alexandre@alapetite.fr> | 2024-09-06 09:35:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-06 09:35:58 +0200 |
commit | 1a552bd60eab4a4b940d3896376b599e155d7da0 (patch) | |
tree | e3872dfc1bc51ed52a88bc22fc7582e858314a71 /docs | |
parent | 35a7634e68d87ad4da46c96ee8066e8c681f8d18 (diff) | |
download | freshrss-1a552bd60eab4a4b940d3896376b599e155d7da0.tar.gz freshrss-1a552bd60eab4a4b940d3896376b599e155d7da0.zip |
Regex search (#6706)
* Regex search
fix https://github.com/FreshRSS/FreshRSS/issues/3549
* Fix PHPStan
* Fix escape
* Fix ungreedy
* Initial support for regex search in PostgreSQL and MySQL
* Improvements, support MySQL
* Fix multiline
* Add support for SQLite
* A few tests
* Added author: and inurl: support, documentation
* author example
* Remove \b for now
* Disable regex sanitization for now
* Fix getInurlRegex
* getNotInurlRegex
* Quotes for inurl:
* Fix test
* Fix quoted tags + regex for tags
https://github.com/FreshRSS/FreshRSS/issues/6761
* Fix wrong regex detection
* Add MariaDB
* Fix logic
* Increase requirements for MySQL and MariaDB
Check support for multiline mode in MySQL
* Remove sanitizeRegexes()
* Allow searching HTML code
Allow searching for instance `/<pre>/`
Fix https://github.com/FreshRSS/FreshRSS/issues/6775#issuecomment-2331769883
* Doc regex search HTML
* Fix Doctype
Diffstat (limited to 'docs')
-rw-r--r-- | docs/en/admins/02_Prerequisites.md | 2 | ||||
-rw-r--r-- | docs/en/admins/DatabaseConfig.md | 2 | ||||
-rw-r--r-- | docs/en/developers/06_Reporting_Bugs.md | 2 | ||||
-rw-r--r-- | docs/en/users/10_filter.md | 29 | ||||
-rw-r--r-- | docs/fr/contributing.md | 2 | ||||
-rw-r--r-- | docs/fr/developers/02_Github.md | 2 | ||||
-rw-r--r-- | docs/fr/users/01_Installation.md | 2 | ||||
-rw-r--r-- | docs/fr/users/03_Main_view.md | 29 |
8 files changed, 62 insertions, 8 deletions
diff --git a/docs/en/admins/02_Prerequisites.md b/docs/en/admins/02_Prerequisites.md index c54a7fd56..d38093b7a 100644 --- a/docs/en/admins/02_Prerequisites.md +++ b/docs/en/admins/02_Prerequisites.md @@ -9,7 +9,7 @@ You need to verify that your server can run FreshRSS before installing it. If yo | Web server | **Apache 2.4** | nginx, lighttpd<br />minimal compatibility with Apache 2.2 | | PHP | **PHP 8.1+** | FreshRSS 1.21/1.22: PHP 7.2+; FreshRSS 1.23/1.24: PHP 7.4+ | | PHP modules | Required: libxml, cURL, JSON, PDO_MySQL, PCRE and ctype.<br />Required (32-bit only): GMP <br />Recommended: Zlib, mbstring, iconv, ZipArchive<br />*For the whole modules list see [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/edge/Docker/Dockerfile-Alpine#L7-L9)* | | -| Database | **PostgreSQL 10+** | SQLite, MySQL 5.5.3+, MariaDB 5.5+ | +| Database | **PostgreSQL 10+** | SQLite, MariaDB 10.0.5+, MySQL 8.0+ | | Browser | **Firefox** | Chrome, Opera, Safari, or Edge | ## Getting the appropriate version of FreshRSS diff --git a/docs/en/admins/DatabaseConfig.md b/docs/en/admins/DatabaseConfig.md index 575749a7f..bc9b6a175 100644 --- a/docs/en/admins/DatabaseConfig.md +++ b/docs/en/admins/DatabaseConfig.md @@ -1,6 +1,6 @@ # Database configuration -FreshRSS supports the databases SQLite (built-in), PostgreSQL, MySQL / MariaDB. +FreshRSS supports the databases SQLite (built-in), PostgreSQL, MariaDB / MySQL. While the default installation should be fine for most cases, additional tuning can be made. diff --git a/docs/en/developers/06_Reporting_Bugs.md b/docs/en/developers/06_Reporting_Bugs.md index 690330118..0c5d255ff 100644 --- a/docs/en/developers/06_Reporting_Bugs.md +++ b/docs/en/developers/06_Reporting_Bugs.md @@ -64,7 +64,7 @@ Remember to give the following information if you know it: 1. Which browser? Which version? 2. Which server: Apache, Nginx? Which version? 3. Which version of PHP? -4. Which database: SQLite, MySQL, MariaDB, PostgreSQL? Which version? +4. Which database: SQLite, PostgreSQL, MariaDB, MySQL? Which version? 5. Which distribution runs on the server? And… which version? ## How to provide feed data diff --git a/docs/en/users/10_filter.md b/docs/en/users/10_filter.md index 519130c14..943537471 100644 --- a/docs/en/users/10_filter.md +++ b/docs/en/users/10_filter.md @@ -49,7 +49,7 @@ You can use the search field to further refine results: * by author: `author:name` or `author:'composed name'` * by title: `intitle:keyword` or `intitle:'composed keyword'` * by URL: `inurl:keyword` or `inurl:'composed keyword'` -* by tag: `#tag` or `#tag+with+whitespace` +* by tag: `#tag` or `#tag+with+whitespace` or or `#'tag with whitespace'` * by free-text: `keyword` or `'composed keyword'` * by date of discovery, using the [ISO 8601 time interval format](http://en.wikipedia.org/wiki/ISO_8601#Time_intervals): `date:<date-interval>` * From a specific day, or month, or year: @@ -105,6 +105,8 @@ can be used to combine several search criteria with a logical *or* instead: `aut You don’t have to do anything special to combine multiple negative operators. Writing `!intitle:'thing1' !intitle:'thing2'` implies AND, see above. For more pointers on how AND and OR interact with negation, see [this GitHub comment](https://github.com/FreshRSS/FreshRSS/issues/3236#issuecomment-891219460). Additional reading: [De Morgan’s laws](https://en.wikipedia.org/wiki/De_Morgan%27s_laws). +> ℹ️ Searches are applied to the raw HTML content + Finally, parentheses may be used to express more complex queries, with basic negation support: * `(author:Alice OR intitle:hello) (author:Bob OR intitle:world)` @@ -115,6 +117,31 @@ Finally, parentheses may be used to express more complex queries, with basic neg > ℹ️ If you need to search for a parenthesis, it needs to be escaped like `\(` or `\)` +### Regex + +Text searches (including `author:`, `intitle:`, `inurl:`, `#`) may use regular expressions, which must be enclosed in `/ /`. + +Regex searches are case-sensitive by default, but can be made case-insensitive with the `i` modifier like: `/Alice/i` + +Supports multiline mode with `m` modifier like: `/^Alice/m` + +> ℹ️ `author:` is working with one author per line, so the multiline mode may advantageously be used, like: `author:/^Alice Dupont$/im` +> +> ℹ️ `#` is likewise working with one tag per line, so the multiline mode may advantageously be used, like: `#/^Hello World$/im` + +Example to search entries, which title starts with the *Lol* word, with any number of *o*: `intitle:/^Lo+l/i` + +As opposed to normal searches, HTML special characters are not escaped in regex searches, to allow searching HTML code, like: `/Hello <span>world<\/span>/` + +⚠️ Advanced regex syntax details depend on the regex engine used: + +* FreshRSS filter actions such as auto-mark-as-read and auto-favourite use [PHP preg_match](https://php.net/function.preg-match). +* Regex searches depend on which database you are using: + * For SQLite, [PHP preg_match](https://php.net/function.preg-match) is used; + * [For PostgreSQL](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP); + * [For MariaDB](https://mariadb.com/kb/en/pcre/); + * [For MySQL](https://dev.mysql.com/doc/refman/9.0/en/regexp.html#function_regexp-like). + ## By sorting by date You can change the sort order by clicking the toggle button available in the header. diff --git a/docs/fr/contributing.md b/docs/fr/contributing.md index c1742d62b..0ffbe806e 100644 --- a/docs/fr/contributing.md +++ b/docs/fr/contributing.md @@ -32,7 +32,7 @@ Nous avons aussi besoin de quelques informations : * Votre version de FreshRSS (sur la page A propos) ou le fichier `constants.php`) * Votre configuration de serveur : type d’hébergement, version PHP -* Quelle base de données : SQLite, MySQL, MariaDB, PostgreSQL ? Quelle version ? +* Quelle base de données : SQLite, PostgreSQL, MariaDB, MySQL ? Quelle version ? * Si possible, les logs associés (logs PHP et logs FreshRSS sous `data/users/your_user/log.txt`) ## Corriger un bogue diff --git a/docs/fr/developers/02_Github.md b/docs/fr/developers/02_Github.md index 0f1aaeb0d..190eed9f2 100644 --- a/docs/fr/developers/02_Github.md +++ b/docs/fr/developers/02_Github.md @@ -100,7 +100,7 @@ Pensez à donner les informations suivantes si vous les connaissez : 1. Quel navigateur ? Quelle version ? 2. Quel serveur : Apache, Nginx ? Quelle version ? 3. Quelle version de PHP ? -4. Quelle base de données : SQLite, MySQL, MariaDB, PostgreSQL ? Quelle version ? +4. Quelle base de données : SQLite, PostgreSQL, MariaDB, MySQL ? Quelle version ? 5. Quelle distribution sur le serveur ? Et… quelle version ? ## Système de branches diff --git a/docs/fr/users/01_Installation.md b/docs/fr/users/01_Installation.md index 390052ec5..ecee8702b 100644 --- a/docs/fr/users/01_Installation.md +++ b/docs/fr/users/01_Installation.md @@ -9,7 +9,7 @@ Il est toutefois de votre responsabilité de vérifier que votre hébergement pe | Serveur web | **Apache 2.4+** | nginx, lighttpd | | PHP | **PHP 8.1+** | | | Modules PHP | Requis : libxml, cURL, JSON, PDO_MySQL, PCRE et ctype<br />Requis (32 bits seulement) : GMP<br />Recommandé : Zlib, mbstring et iconv, ZipArchive<br />*Pour une liste complète des modules nécessaires voir le [Dockerfile](https://github.com/FreshRSS/FreshRSS/blob/edge/Docker/Dockerfile-Alpine#L7-L9)* | | -| Base de données | **PostgreSQL 10+** | SQLite, MySQL 5.5.3+, MariaDB 5.5+ | +| Base de données | **PostgreSQL 10+** | SQLite, MariaDB 10.0.5+, MySQL 8.0+ | | Navigateur | **Firefox** | Chrome, Opera, Safari, or Edge | ## Choisir la bonne version de FreshRSS diff --git a/docs/fr/users/03_Main_view.md b/docs/fr/users/03_Main_view.md index 788143171..2af7a86b5 100644 --- a/docs/fr/users/03_Main_view.md +++ b/docs/fr/users/03_Main_view.md @@ -208,7 +208,7 @@ Il est possible d’utiliser le champ de recherche pour raffiner les résultats * par auteur : `author:nom` ou `author:'nom composé'` * par titre : `intitle:mot` ou `intitle:'mot composé'` * par URL : `inurl:mot` ou `inurl:'mot composé'` -* par tag : `#tag` +* par tag : `#tag` ou `#'tag avec espace'` * par texte libre : `mot` ou `'mot composé'` * par date d’ajout, en utilisant le [format ISO 8601 d’intervalle entre deux dates](https://fr.wikipedia.org/wiki/ISO_8601#Intervalle_entre_deux_dates) : `date:<intervalle-de-dates>` * D’un jour spécifique, ou mois, ou année : @@ -264,6 +264,8 @@ encore plus précis, et il est autorisé d’avoir plusieurs instances de : Combiner plusieurs critères implique un *et* logique, mais le mot clef `OR` peut être utilisé pour combiner plusieurs critères avec un *ou* logique : `author:Dupont OR author:Dupond` +> ℹ️ Les recherches sont effectuées sur le code HTML brut + Enfin, les parenthèses peuvent être utilisées pour des expressions plus complexes, avec un support basique de la négation : * `(author:Alice OR intitle:bonjour) (author:Bob OR intitle:monde)` @@ -273,3 +275,28 @@ Enfin, les parenthèses peuvent être utilisées pour des expressions plus compl * `!(S:1 OR S:2)` > ℹ️ Si vous devez chercher une parenthèse, elle doit être *échappée* comme suit : `\(` ou `\)` + +#### Regex + +Les recherches de texte (incluant `author:`, `intitle:`, `inurl:`, `#`) peuvent utiliser les expressions régulières qui doivent être exprimées comme `/ /`. + +Les recherches regex sont sensibles à la casse, mais peuvent être rendues insensibles à la casse avec l’option de recherche `i` comme : `/Alice/i` + +Le mode multilignes peut être activé avec l’option de recherche `m` comme : `/^Alice/m` + +> ℹ️ `author:` fonctionne avec un auteur par ligne, ce qui fait que le mode multilignes peut être avantageux, comme : `author:/^Alice Doe$/im` +> +> ℹ️ `#` fonctionne également avec un tag par line, ce qui fait que le mode multilignes peut être avantageux, comme : `#/^Hello World$/im` + +Exemple pour rechercher des articles dont le titre commence par le mot *Lol* avec un nombre indéterminé de *o*: `intitle:/^Lo+l/i` + +Contrairement aux recherches normales, les caractères spéciaux HTML ne sont pas encodés dans les recherches regex, afin de permettre de chercher du code HTML, comme : `/Bonjour <span>à tous<\/span>/` + +⚠️ Les détails de syntaxe regex avancée dépendent du moteur regex utilisé : + +* Les filtres d’action de FreshRSS comme marquer-automatiquement-comme-lu et mettre-automatiquement-en-favori utilisent [PHP preg_match](https://php.net/function.preg-match). +* Les recherches regex dépendent de la base de données utilisée : + * Pour SQLite, [PHP preg_match](https://php.net/function.preg-match) est utilisé ; + * [Pour PostgreSQL](https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP) ; + * [Pour MariaDB](https://mariadb.com/kb/en/pcre/) ; + * [Pour MySQL](https://dev.mysql.com/doc/refman/9.0/en/regexp.html#function_regexp-like). |