Hacker News new | ask | show | jobs
by arpowers 1021 days ago

    const pattern = /I hope this (\w+) finds you well\./;

    if (pattern.test(text)) {
      console.log("is ai.");
    } else {
      console.log("not ai.");
    }
2 comments

This won't work, you'd need at least... 3 more test cases.

    /I hope this (\w+) finds you well\.|It's important to note that |As a large language model/
You may need one of the adjacent spaces in your capture group
I hope this dfajklgsdfjklagsdfjklsd finds you well.