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

  • SEARCH
  • Home
  • 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 510953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:10:00+00:00 2026-05-13T07:10:00+00:00

I am looking for a good .NET regular expression that I can use for

  • 0

I am looking for a good .NET regular expression that I can use for parsing out individual sentences from a body of text.

It should be able to parse the following block of text into exactly six sentences:

Hello world! How are you? I am fine.
This is a difficult sentence because I use I.D.

Newlines should also be accepted. Numbers should not cause  
sentence breaks, like 1.23.

This is proving a little more challenging than I originally thought.

Any help would be greatly appreciated. I am going to use this to train the system on known bodies of text.

  • 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-05-13T07:10:00+00:00Added an answer on May 13, 2026 at 7:10 am

    Try this @"(\S.+?[.!?])(?=\s+|$)":

    string str=@"Hello world! How are you? I am fine. This is a difficult sentence because I use I.D.
    Newlines should also be accepted. Numbers should not cause sentence breaks, like 1.23.";
    
    Regex rx = new Regex(@"(\S.+?[.!?])(?=\s+|$)");
    foreach (Match match in rx.Matches(str)) {
        int i = match.Index;
        Console.WriteLine(match.Value);
    }
    

    Results:

    Hello world!
    How are you?
    I am fine.
    This is a difficult sentence because I use I.D.
    Newlines should also be accepted.
    Numbers should not cause sentence breaks, like 1.23.
    

    For complicated ones, of course, you will need a real parser like SharpNLP or NLTK. Mine is just a quick and dirty one.

    Here is the SharpNLP info, and features:

    SharpNLP is a collection of natural
    language processing tools written in
    C#. Currently it provides the
    following NLP tools:

    • a sentence splitter
    • a tokenizer
    • a part-of-speech tagger
    • a chunker (used to “find non-recursive syntactic annotations such as noun phrase chunks”)
    • a parser
    • a name finder
    • a coreference tool
    • an interface to the WordNet lexical database
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with .NET
I am looking for a good menu to use in an ASP.NET. I am
I'm looking for a good dropdown node tree that has checkboxes. Similar to ASP.NET
alt text http://img706.imageshack.us/img706/3876/screenshot20100621at110.png Looking good here in the result, but I can't achieve the
I was looking for Good/Simple webservice which can be consumed using asp.net but I
I'm looking for a signature pad that has good C# .net development tools such
Looking for a good quality .NET Control library that provides shell capabilities such as
Can someone recommend to me a good .NET library that can encode and decode
I'm looking for good patterns for implementing a paged table of results in ASP.NET
I'm looking for a good audio compression library for .NET. Anything using MP3 is

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.