2

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

Andy Lester
  • 91,102
  • 13
  • 100
  • 152
zearth
  • 151
  • 1
  • 1
  • 8
  • 3
    http://stackoverflow.com/questions/6751105/why-its-not-possible-to-use-regex-to-parse-html-xml-a-formal-explanation-in-la – Cfreak Feb 20 '14 at 22:54

2 Answers2

2

This would likely capture anything between standard <body> tags

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

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

l'L'l
  • 44,951
  • 10
  • 95
  • 146
1

Use this regex

'#<body>(.*?)<\/body>#s'
LONGMAN
  • 980
  • 1
  • 14
  • 24