Click here to Skip to main content
15,887,291 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Who is still programming past 65 yo? Pin
Daniel Pfeffer24-Jul-20 3:36
professionalDaniel Pfeffer24-Jul-20 3:36 
GeneralRe: Who is still programming past 65 yo? Pin
Sander Rossel24-Jul-20 3:59
professionalSander Rossel24-Jul-20 3:59 
GeneralRe: Who is still programming past 65 yo? Pin
DerekT-P24-Jul-20 1:43
professionalDerekT-P24-Jul-20 1:43 
JokeRe: Who is still programming past 65 yo? Pin
Daniel Pfeffer24-Jul-20 3:34
professionalDaniel Pfeffer24-Jul-20 3:34 
GeneralRe: Who is still programming past 65 yo? Pin
pkfox24-Jul-20 5:20
professionalpkfox24-Jul-20 5:20 
GeneralRe: Who is still programming past 65 yo? Pin
H.Brydon25-Jul-20 5:09
professionalH.Brydon25-Jul-20 5:09 
QuestionA question I dare not ask on Stackoverflow Pin
Peltier Cooler23-Jul-20 9:02
professionalPeltier Cooler23-Jul-20 9:02 
AnswerRe: A question I dare not ask on Stackoverflow Pin
Ravi Bhavnani23-Jul-20 10:54
professionalRavi Bhavnani23-Jul-20 10:54 
You can use my StringParser[^] to do exactly this.
C#
using System;
using System.Collections.Generic;
using System.Linq;
using RavSoft;

namespace StringParserExample
{
    class Program
    {
        static void Main(string[] args)
        {
            // The corpus
            string corpus = @"
                I'm crafty like a fox.  But it's not as if anyone cares.
                Covered as an examine so regular of. Ye astonished friendship
                remarkably like a potentiometer.  Windows admire matter praise
                you as if they really care. Delivered ye sportsmen zealously
                like an elephant who never forgets.  Nay any article enabled
                musical shyness yet sixteen yet blushes.";

            // Initialization
            List<string> similies = new List<string>();
            string phrase = null;
            StringParser sp = new StringParser(corpus);

            // Get phrases following "like a"
            while (sp.skipToEndOf(" like a ")) {
                if (sp.extractTo(".", ref phrase)) {
                    similies.Add(phrase);
                }
            }

            // Get phrases following "as if"
            sp.resetPosition();
            while (sp.skipToEndOf(" as if ")) {
                if (sp.extractTo(".", ref phrase)) {
                    similies.Add(phrase);
                }
            }

            // Output results
            foreach(string similie in similies.OrderBy(p => p)) {
                Console.WriteLine(similie);
            }
        }
    }
}
/ravi
My new year resolution: 2048 x 1536
Home | Articles | My .NET bits | Freeware
ravib(at)ravib(dot)com

GeneralRe: A question I dare not ask on Stackoverflow Pin
Peltier Cooler23-Jul-20 11:07
professionalPeltier Cooler23-Jul-20 11:07 
GeneralRe: A question I dare not ask on Stackoverflow Pin
User 1106097923-Jul-20 12:39
User 1106097923-Jul-20 12:39 
GeneralRe: A question I dare not ask on Stackoverflow Pin
jeron123-Jul-20 13:27
jeron123-Jul-20 13:27 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Ravi Bhavnani23-Jul-20 18:57
professionalRavi Bhavnani23-Jul-20 18:57 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Ravi Bhavnani23-Jul-20 18:57
professionalRavi Bhavnani23-Jul-20 18:57 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Garth J Lancaster23-Jul-20 21:06
professionalGarth J Lancaster23-Jul-20 21:06 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Ravi Bhavnani24-Jul-20 9:11
professionalRavi Bhavnani24-Jul-20 9:11 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Johnny J.23-Jul-20 21:44
professionalJohnny J.23-Jul-20 21:44 
GeneralRe: A question I dare not ask on Stackoverflow Pin
Ravi Bhavnani24-Jul-20 9:23
professionalRavi Bhavnani24-Jul-20 9:23 
AnswerRe: A question I dare not ask on Stackoverflow Pin
obermd24-Jul-20 3:43
obermd24-Jul-20 3:43 
AnswerRe: A question I dare not ask on Stackoverflow Pin
Nelek25-Jul-20 7:53
protectorNelek25-Jul-20 7:53 
QuestionYour preferred Git UI (if any)? Pin
Ravi Bhavnani23-Jul-20 8:38
professionalRavi Bhavnani23-Jul-20 8:38 
AnswerRe: Your preferred Git UI (if any)? PinPopular
OriginalGriff23-Jul-20 8:52
mveOriginalGriff23-Jul-20 8:52 
GeneralRe: Your preferred Git UI (if any)? Pin
Greg Utas23-Jul-20 9:12
professionalGreg Utas23-Jul-20 9:12 
GeneralRe: Your preferred Git UI (if any)? Pin
ISanti23-Jul-20 20:15
ISanti23-Jul-20 20:15 
GeneralRe: Your preferred Git UI (if any)? Pin
OriginalGriff23-Jul-20 21:22
mveOriginalGriff23-Jul-20 21:22 
GeneralRe: Your preferred Git UI (if any)? Pin
agolddog24-Jul-20 5:23
agolddog24-Jul-20 5:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.