Question

how to capture all codes inside the html .... in regex format? currently I tried several codes but it is not capturing all, I tried this

<body>([^*]*)<\/body>

but it didnt capture all codes because some javascript code is affecting the regex command.

do you know any link or sample to solve this issue?

TIA

Was it helpful?

Solution

This would likely capture anything between standard <body> tags

(?:<body>((?s).*)<\/body>)

example: http://regex101.com/r/iS4eE3

OTHER TIPS

Use this regex

'#<body>(.*?)<\/body>#s'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top