Ho questo semplice codice:
codice:
Private Shared ReadOnly SentenceRegex As New Regex("(?<Word>\W?\w+\W?)+?(\.|\!|\?)", RegexOptions.Multiline Or RegexOptions.Compiled)
'...
Dim Content As String = IO.File.ReadAllText(FileName)
'...
Dim Matches As MatchCollection = SentenceRegex.Matches(Content)
For Each M As Match In Matches
Debug.WriteLine(M.Value)
Next
Content vale:
codice:
INTRODUCTION.
When on board HMS 'Beagle,' as naturalist, I was much struck with
certain facts in the distribution of the inhabitants of South America,
and in the geological relations of the present to the past inhabitants
of that continent. These facts seemed to me to throw some light on the
origin of species--that mystery of mysteries, as it has been called by
one of our greatest philosophers. On my return home, it occurred to
me, in 1837, that something might perhaps be made out on this question
by patiently accumulating and reflecting on all sorts of facts which
could possibly have any bearing on it. After five years' work I
allowed myself to speculate on the subject, and drew up some short
notes; these I enlarged in 1844 into a sketch of the conclusions,
which then seemed to me probable: from that period to the present day
I have steadily pursued the same object. I hope that I may be excused
for entering on these personal details, as I give them to show that I
have not been hasty in coming to a decision.
eccetera...
Nella finestra di Debug viene scritto "INTRODUCTION" e basta. Il codice nel ciclo non si ripete, ma il codice dopo il ciclo non viene comunque eseguito. Non si verifica nessun errore. E' come se l'esecuzione fosse sospesa su Next, non va né avanti né indietro e non capisco perchè. Possibili spiegazioni?