0

Then i trying to extract hex code between tags with preg_match_all function i have some problems using regex

#<\b(html|body)\b[^>]*>(.*?)</\b(html|body)\b>#is

work, extract all lines but without new line simbols? so after converting hex2bin i got unreadable parts

#<\b(html|body)\b[^>]*>(.*?)</\b(html|body)\b>#im

work but extract only single lines, do not extract lines contains new line

So how to extract hex code between tags including all characters.

Dmitrij Holkin
  • 1,995
  • 3
  • 39
  • 86
  • 1
    [Don't parse HTML with REGEX](http://stackoverflow.com/a/1732454/1519058), use a [DOM parser instead](http://stackoverflow.com/a/3577662/1519058)... – Enissay Jan 06 '15 at 18:52
  • Could you explain what you mean with: `but extract only single lines lines contains new line do not extracting`? – Toto Jan 06 '15 at 18:52

1 Answers1

0

To match hex you can use:

(?:0x|\$)?[0-9a-f]{5,10}h?

This regex matches the hex code from min 5 to max 10 characters.

Andie2302
  • 4,825
  • 4
  • 24
  • 43