Regular expression that doesn't recognize newline

  • Thread starter Thread starter Antonio
  • Start date Start date
A

Antonio

Good morning,
I've the following part of an html file,

////////////////////////////////////////////////////////////////////////
</font></b></td>
</tr> <tr>
<td bgcolor=white class=s><div style=padding:10px;>Computer
science, Universit,
Economy, Finance</div></td>
</tr>
////////////////////////////////////////////////////////////////////////

I would want to extract the words "Computer science, Universit,
Economy, Finance" using the following regular expression:

style=padding:10px;>(?<Traduzione>(?:\w|\s|\.|\d|\:|\"|\,|\?|\'|\-)*)</div></td>

the problem is that it doesn't recognize the newline character after
Universit, so the result is no match but I can't understand why, can
you help me to solve the problem???

Many thanks,

Antonio D'Ottavio
www.etantonio.it/en
(e-mail address removed)
 
Antonio said:
Good morning,
I've the following part of an html file,

////////////////////////////////////////////////////////////////////////
</font></b></td>
</tr> <tr>
<td bgcolor=white class=s><div style=padding:10px;>Computer
science, Universit,
Economy, Finance</div></td>
</tr>
////////////////////////////////////////////////////////////////////////

I would want to extract the words "Computer science, Universit,
Economy, Finance" using the following regular expression:

style=padding:10px;>(?<Traduzione>(?:\w|\s|\.|\d|\:|\"|\,|\?|\'|\-)*)</div></td>

Just curious: Why do you use such a complex list of alternatives? Wouldn't
something simple like:
the problem is that it doesn't recognize the newline character after
Universit, so the result is no match but I can't understand why, can
you help me to solve the problem???

I tested it, and it did match. Maybe there's another problem with your code?
What flags did you use to initialize the RegEx class? In your string, is
there a "\n" or a "\r\n"? (Just guessing)

Niki
 
Back
Top