Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Dear friends,
 
First You will be thankful if u solved my problem...
 
Description:

I have developing window application for editing xml content.now 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?
 

Eg:
 
<keyword>store</keyword>
<paragraph>mystery customer. Buckley continues to order Rasaratnam to hand over the cash and tells other customers to leave the store. Stick-up! Armed raider is overpowered in shop From Page One The dramatic CCTV footage shows shopworker Rasaratnam being ordered to put his hands on the counter, but he refuses to </paragraph >
Posted 30-Jan-13 23:09pm
jai_mca1.1K
Edited 30-Jan-13 23:12pm
v3
Comments
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
good
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.
  Permalink  
Comments
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 OriginalGriff 385
1 Sergey Alexandrovich Kryukov 329
2 CPallini 270
3 DamithSL 214
4 Maciej Los 192
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2014
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