Guest User

Untitled

a guest
Feb 16th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. $subject = 'abc dont@get.me 123 <input value="please@get.me">xyz';
  3. $pattern = '/[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,}/i';
  4. preg_match_all( $pattern, $subject, $matches );
  5. var_dump( $matches );
  6.  
  7. array(1) { [0]=> array(2) {
  8. [0]=> string(11) "dont@get.me"
  9. [1]=> string(13) "please@get.me"
  10. } }
  11.  
  12. array(1) { [0]=> array(1) {
  13. [0]=> string(13) "value="please@get.me""
  14. } }
  15.  
  16. <?php
  17. $subject = "<br data-xyz=please@get.me /> dont@get.me <[tag] [attr]='[pre] andPlease@get.me [ap]'>";
  18. preg_match_all( $pattern, $subject, $matches );
  19. var_dump( $matches );
  20.  
  21. array(1) { [0]=> array(2) {
  22. [0]=> string(13) "data-xyz=please@get.me"
  23. [1]=> string(13) "[attr]='[pre] andPlease@get.me [ap]'"
  24. } }
Add Comment
Please, Sign In to add comment