There is a string

<tr dir='ltr'><td class=hd><p style='*:*;'>.</td><td class='s*'>*.*.* *:*:*<td dir='ltr' class='s*'>DATA</tr> 

Where * - can be any number of numeric \ text information (only numbers or letters). Need to pull DATA

    1 answer 1

    Why are the asterisks in the entire line? You can get by with only a part with DATA.

      /<td\s*dir='ltr'\s*class='s.*?'>.*?<\/tr>/ 
    • Asterisks - because some tags are repeated and, as I understand, it is necessary to prescribe the entire immutable path. Thanks for the help, but it crashes: Invalid escape sequence (valid ones are \ b \ t \ n \ f \ r \ "\ '\\) - 007
    • Give a piece of code where this happens. You need to escape slashes and quotes. - Opalosolo
    • I do this: String dateComponent = null; Pattern p = Pattern.compile ("/ <td \ s dir = 'ltr' \ s class = 's. *?'>. *? <\ / Tr> /"); Matcher m = p.matcher (" site.com/" ); if (m.find ()) {dateComponent = m.toMatchResult (). group (1); } He sees the error on the entire line - 007
    • @ 007 - so that the code is output normally, frame it with the symbol `(this is where the letter" Ё ") - Opalosolo
    • ua6xh, no ideas on solving the problem? - 007