Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

You can use Shortest if the sub-strings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this linkthis link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You can use Shortest if the sub-strings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You can use Shortest if the sub-strings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

Corrected answer to indicate restrictions
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

You can use Shortest if the substringssub-strings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You can use Shortest if the substrings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You can use Shortest if the sub-strings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

Post Undeleted by m_goldberg
Corrected answer to indicate restrictions
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

You want tocan use Shortest if the substrings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["class=testShortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You want to use Shortest.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

You can use Shortest if the substrings of the form <td, class=test, >...</td> don't contain nested sub-strings of the form <td, class=test, > or </td>. If they do, follow this link.

v = "...<td, class=test, >strings1</td>...<td, class=test, >strings2</td>..";
StringCases[v, Shortest["<td, class=test, >" ~~ x__ ~~ "</td>"] -> x]

{"strings1", "strings2"}

Post Deleted by m_goldberg
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
Loading