regex - Matching multiline text using regular expression in java -


my input sample is:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/tr/rec-html40">  <head> <meta http-equiv=content-type content="text/html; charset=windows-1252"> <meta name=progid content=word.document> <meta name=generator content="microsoft word 15"> <meta name=originator content="microsoft word 15"> <link rel=file-list href="detailedfoot_files/filelist.xml"> 

what want want select whole html tag , replace something. using regular expression

<html.*> 

if use regular expression in mather.dotall manner, whole text input replaced.

i cant figure out how it. kind of appreciated.

this regex seems capture you're looking for.

pattern = "\<html[^>]*>?(.*)" 

sample here


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -