Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yakafokon: simplification de la regex et correction du cas "ça serait bien" #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Deuchnord
Copy link

Correction d'une erreur dans la regex qui invalidait le cas du "ça serait bien que".

Test des différents cas pris en charge (ou volontairement écartés) sur Regex101 :

Capture d’écran Regex101

src/alain/alain3.py Outdated Show resolved Hide resolved
@@ -42,7 +42,7 @@ def lol(self, mask=None, channel=None, data=None):

@irc3.event(
r":(?P<mask>\S+) PRIVMSG {channel} :"
r".*\s(faudrai.|faut|ca serait bien que)\s+qu.*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi enlever ce \s ? Il a du sens pour moi, pour éviter des faux positifs comme "arguments par défaut qui sont None"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me dis qu'une alternative, si on veut reconnaître "faut que..." après un espace mais aussi en début de ligne, serait de mettre \b (frontière de mot) avant le motif.

\b Matches the empty string, but only at the beginning or end of a word.

https://docs.python.org/3/library/re.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vendu pour \b. Tu as raison ça règle plein de cas, comme (faut que qu'on merge ça).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai pas encore eu l'occasion de m'en occuper, je fais ça plus tard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants