Subject: regular expression extraction paragraph
Posted By: radhakrishnan1976 Post Date: 4/7/2006 4:35:28 AM
Hi,

   The regex

    \(\((\w*?\W*?)*?\)\)  

    is working in regex tester

    http://regexlib.com/RETester.aspx

 

once i apply this in my code it is showing "index was out side the bounds of the array error"

any suggestions?

My code

string strInput = TxtInputString.Text;  //<- input

string strRegEx = TxtRegex.Text;   //<- RegeX

Regex DateLineRE = new Regex(strRegEx,RegexOptions.Multiline);

MatchCollection matches = DateLineRE.Matches(strInput);

foreach(Match match in matches)

{

MessageBox.Show(match.Value);

}


input is

MultiChoice said it welcomed competition, which would ensure
more choice and programme diversity.
    "It will be good for the pay-TV industry ... and attract the
necessary investment into the broadcasting industry and the
South African economy," Chief Executive Nolo Letele said in a
statement.
    Shares in Naspers were up 0.87 percent at 127.60 rand at
1402 GMT, when the top-40 index of blue-chip stocks &lt;.JTOPI&gt; was
up 0.94 percent.
 ((Reporting by Rebecca Harrison, editing by Greg Mahlich;
Johannesburg newsroom +27 11 775 3159;
rebecca.harrison@reuters.com))

output is
((Reporting by Rebecca Harrison, editing by Greg Mahlich;
Johannesburg newsroom +27 11 775 3159;
rebecca.harrison@reuters.com))

Thanks in advance

Radhakrishnan.k

 



Go to topic 42576

Return to index page 320
Return to index page 319
Return to index page 318
Return to index page 317
Return to index page 316
Return to index page 315
Return to index page 314
Return to index page 313
Return to index page 312
Return to index page 311