Click here to Skip to main content
12,632,417 members (34,139 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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>
Posted 30-Jan-13 23:09pm
jai_mca1.1K
Updated 30-Jan-13 23:12pm
v3
Comments
VitorHugoGarcia 31-Jan-13 4:22am
   
the first thing that come to me mind is LINQ
jai_mca 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 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 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 31-Jan-13 4:33am
   
many thanks rahul..i will check it out..
get in touch..
Rahul Rajat Singh 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 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
Top Experts
Last 24hrsThis month


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