Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:53:25+00:00 2026-06-15T09:53:25+00:00

I need a Regex to detect questions within a text. Example input: please, tell

  • 0

I need a Regex to detect questions within a text.

Example input:

please, tell me how to do this… or how to make it right! and so on….

I need output:

  1. how to do this
  2. how to make it right

Now I use this:
(?<q>(how to|how match|how many).*)(\s|\.|;|!|\?|( \-)|(\- )|‾|:|…|_|\||@|~|…|–|—|¯|»|•|●|{|}|\(|\)|\\|\]|\[|>|<|→|'|""|`|$) but does not work

I need only how to questions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:53:26+00:00Added an answer on June 15, 2026 at 9:53 am

    The task you are trying to accomplish falls under a different category than what regular expressions are good for.

    To solve the problem of extracting arbitrary questions from text you need a lot more than just a few good regular expressions. You should start looking at a good natural language processing toolkit. And maybe first do some Part of Speech tagging. Then, from there you will need to do some syntax and sentence parsing and then move on to try to answer the question of: “Is this a sentence a question?” by examining each sentence your NLP pipeline will have identified.

    Armed with this knowledge, at a minimum, you should understand that the task you want to accomplish is rather difficult and while not impossible will require a lot of fine tuning to get good performance (usually measured with Accuracy and Precision metrics). You will most likely not get anywhere near 100% on either but you should be able to get decent results with a good PoS tagger and a good sentence parser.

    EDIT

    In light of your recent edit to the question, you may be able to get some basic coverage with RegExs and hand-written rules but you will still fail to differentiate many more complicated cases. The natural language processing toolkit route is still preferred for a more generic solution.

    Don’t spend too much time trying to come up with a silver bullet regular expression to match natural language. Natural language is not regular – so it’s not going to work! It’s ok to use regular expressions to identify some keywords but beyond that you’re better off with simple hand-written rules, and tokenizing in lue of a good natural language pipeline..

    UPDATE

    If you’re really serious about this task, have a look at sharpnlp.codeplex.com as a starting point. There are other NLP tool-kits out there with NLTK springing to mind as a popular one if you’re not required to use C#. As a second step, get yourself an introductory book on NLP. The subject is vast and really cool. A great book I’ve learned a lot from would be: Speech and Language Processing by Jurafski and Martin.

    And as a final thought, here’s what I would do at a minimum:

    1. perform normalization (remove any symbols that you don’t need, and duplicates)
    2. try to do basic sentence segmentation (split at punctuation: . , ; ? !)
    3. convert all letters to lowercase
    4. replace all numbers with a tag (i.e. )
    5. perform Part of Speech tagging on each of the normalized sentences
    6. then you can move on to try to determine where all the “how to” questions are located in the text.
    7. after you have your locations you should be able to map them back to the original text and extract the original “How To” questions from there

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a regex code which will detect format like this 1-2-2-2-1-5.This can be
I need to write regex in this code to detect id on url like
I need detect words that separate with space in a text. for example my
I need a regex that will give me the following results from each example
i need a regex to replace a string. <span class=\Translation\ lang=\ThisLanguage\> with this one:
I need regex that will match this Fred, Jhon, Tree, and there could be
I need a regex which will detect multiple occurrences of the new line character
Couldn't find a function for this. I'm assuming I need to use regex? I'm
I need help in writing a RegEx able to detect 1 or more instance
I need a regex that will check the input of a textarea form and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.