Skip to content

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


@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