Sample query:

Write a regex that will catch questions. Make sure that it includes "sloppy" questions - without question mark at the end of a sentence.

Here's a list of keywords:

  1. SEO basics
  2. SEO strategies
  3. What are the key elements of effective SEO?
  4. How can I improve my website's SEO ranking
  5. On-page SEO
  6. What are the best SEO tools to use
  7. Off-page SEO
  8. SEO best practices

Sample output:

Here's a regex pattern that can catch questions, including "sloppy" questions without a question mark at the end:

Copy code
\\b(What|How|Where|When|Why|Which|Who|Whom|Whose)\\b.*?[?\\.]?

This regex pattern will match any sentence that starts with a question word (e.g., What, How, Where, etc.) and ends with either a question mark or a period, allowing for "sloppy" questions that lack a question mark at the end. Note that the pattern assumes that each sentence is separated by a period.

Here's an example of how this pattern would match the provided list of keywords:

  1. "SEO basics" - Not a question, does not match.
  2. "SEO strategies" - Not a question, does not match.
  3. "What are the key elements of effective SEO?" - A valid question, matches.
  4. "How can I improve my website's SEO ranking" - A valid question, matches.
  5. "On-page SEO" - Not a question, does not match.
  6. "What are the best SEO tools to use" - A valid question, matches.
  7. "Off-page SEO" - Not a question, does not match.
  8. "SEO best practices" - Not a question, does not match.

Please note that this regex pattern may need to be adjusted based on the specific requirements and patterns you're working with.