Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $subject = 'abc dont@get.me 123 <input value="please@get.me">xyz';
- $pattern = '/[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,}/i';
- preg_match_all( $pattern, $subject, $matches );
- var_dump( $matches );
- array(1) { [0]=> array(2) {
- [0]=> string(11) "dont@get.me"
- [1]=> string(13) "please@get.me"
- } }
- array(1) { [0]=> array(1) {
- [0]=> string(13) "value="please@get.me""
- } }
- <?php
- $subject = "<br data-xyz=please@get.me /> dont@get.me <[tag] [attr]='[pre] andPlease@get.me [ap]'>";
- preg_match_all( $pattern, $subject, $matches );
- var_dump( $matches );
- array(1) { [0]=> array(2) {
- [0]=> string(13) "data-xyz=please@get.me"
- [1]=> string(13) "[attr]='[pre] andPlease@get.me [ap]'"
- } }
Add Comment
Please, Sign In to add comment