Click here to Skip to main content
11,796,631 members (73,116 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
Dear friends,

First You will be thankful if u solved my problem...


I have developing window application for editing xml my problem was,how to select an sentence from paragraph based on a word.we need to select an sentence where the word exist from paragraph.

To be clear in the below example,we need to find the store in the paragraph tag content.then select the sentence where the store exist.

is it possible using regular expression concept?how?


Posted 30-Jan-13 22:09pm
Edited 30-Jan-13 22:12pm
VitorHugoGarcia at 31-Jan-13 4:22am
the first thing that come to me mind is LINQ
jai_mca at 31-Jan-13 4:31am
dear VitorHugoGarcia,thanks for ur reply..
if possible through linq means can u suggest a code?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why not split the paragraph into sentences using string's split function on .(period/full stop). Then check for the word in each sentence one by one from the split-ed array and use the ones that contains the word and throw away the rest.
jai_mca at 31-Jan-13 4:29am
yes rahul..i have the same idea.but how to get a sentence based on the period?
Rahul Rajat Singh at 31-Jan-13 4:30am
if the paragraph is stored in a string called str then:

string[] splits = atr.split('.'); // convert this to VB code please
jai_mca at 31-Jan-13 4:33am
many thanks rahul..i will check it out..
get in touch..
Rahul Rajat Singh at 31-Jan-13 4:36am
if it works. close the question by marking it as answer so that people will know that it is solved.
jai_mca at 31-Jan-13 4:42am
sure rahul..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 505
1 Abhinav S 417
2 OriginalGriff 360
3 CPallini 285
4 KrunalRohit 249
0 OriginalGriff 2,012
1 Maciej Los 1,725
2 KrunalRohit 1,310
3 CPallini 1,055
4 ppolymorphe 858

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100