sebbu

regex & xpath

Dec 19th, 2020 (edited)
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <?php
  2. $regex='%^
  3. ([a-zA-Z0-9_]+)
  4. \s*\(\s*
  5. ((?:
  6. (?:\[\s*)?
  7. (\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null|[A-Za-z_-]+)(?:\|\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null))*)\s+
  8. (&?(?:\.\.\.)?\$[a-zA-Z0-9_]+)\s*
  9. (=\s*((?:true|false|-?\d+|\d+\.\d*|\.\d+|(?:ini_get\()?[\'"]?[A-Za-z0-9:.\\\\_]+[\'"]?\(?\)?(?:\s*\|\s*[A-Z0-9_]+)*|\'\'|\"\"|null|\[\]|array\s*\(\s*\)))?\s*)?
  10. (?:\]\s*)?)?
  11. (?:\[?,\s*
  12. (\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null|[A-Za-z_-]+)(?:\|\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null))*)\s+
  13. (&?(?:\.\.\.)?\$[a-zA-Z0-9_]+)\s*
  14. (=\s*((?:true|false|-?\d+|\d+\.\d*|\.\d+|(?:ini_get\()?[\'"]?[A-Za-z0-9:.\\\\_]+[\'"]?\(?\)?(?:\s*\|\s*[A-Z0-9_]+)*|\'\'|\"\"|null|\[\]|array\s*\(\s*\)))\s*)?
  15. (?:\]+\s*)?)*
  16. )?
  17. \)
  18. (?:\s*:\s*
  19. (\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null|[A-Za-z_-]+)(?:\|\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null))*)
  20. )?$%x';
  21. $regex2='(?:\[?,?\s*
  22. (\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null|[A-Za-z_-]+)(?:\|\??(?:bool|true|false|int|integer|float|double|string|array|object|mixed|resource|null))*)\s+
  23. (&?(?:\.\.\.)?\$[a-zA-Z0-9_]+)\s*
  24. (=\s*((?:true|false|-?\d+|\d+\.\d*|\.\d+|(?:ini_get\()?[\'"]?[A-Za-z0-9:.\\\\_]+[\'"]?\(?\)?(?:\s*\|\s*[A-Z0-9_]+)*|\'\'|\"\"|null|\[\]|array\s*\(\s*\)))\s*)?
  25. (?:\]+\s*?)?)%x';
  26. $regex0='#<li><a href="function.([a-zA-Z0-9._-]+).html">([a-zA-Z0-9_-]+)</a>(?: \S+ ([^<]+)|\s*)?</li>#';
  27. $xpath1='//div[@class="refentry"]/div[@class="refnamediv"]/p[@class="refpurpose"]';
  28. $xpath2='//div[contains(@class, "description")]/div[contains(@class, "methodsynopsis")][span[contains(@class, "methodname")]]';
  29. $xpath3='//div[@class="refentry"]/div[contains(@class, "description")]/p[@class="para" or @class="simpara"]/span[@class="methodname" or @class="function"]';
  30. $xpath4='//div[span[contains(@class, "methodname")]]';
  31.  
Add Comment
Please, Sign In to add comment