|
|
| "be consistent" | |
| PerlMonks |
Regexp match start or endby Bod (Parson) |
| on Jun 02, 2024 at 13:06 UTC ( [id://11159751]=perlquestion: print w/replies, xml ) | Need Help?? |
|
Bod has asked for the wisdom of the Perl Monks concerning the following question: As I mentioned in Yet another Encoding issue..., I am writing an AI chatbot based around AI::Chat that holds a conversation in Turkish and corrects any mistakes in the Turkish supplied by the user. Of course, there are not always mistakes so a correction is not always needed. I've promoted the AI that But being AI, it can be unpredictable! Sometimes, it will quote the Turkish and then write "Perfect" on a separate line. Currently I check for whether there is a correction like this:
I don't want to check for "Perfect" anywhere in the reply as it might form part of a valid correction. So I am thinking of checking that "Perfect" appears either at the start of the reply or at the end like this:
But is there a way of combining those two regexps into just one? It seems there should be...
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||