regex, multiline extract in R
问题 I am having some problems with deleting everything after the first occurrence of a pattern in R. I have imported the data with paste(readLines(url), collapse="\n") . For example, my string is, \"id=\"fruit_info\">\n<tr class='thead'>\n<th colspan=2>Strawberries</th></table>\n</tr>\n</table>\n<tr class . I want to remove everything after the first occurrence of </table> . What I want to see is; \"id=\"fruit_info\">\n<tr class='thead'>\n<th colspan=2>Strawberries</th> The methods I am trying do