Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'pp'
- def extract_emails_to_array(txt)
- reg = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i
- txt.scan(reg).uniq
- end
- def extract_numbers_to_array(txt)
- reg = /(?:\+?|\b)[0-9]{10}\b/i
- txt.scan(reg).uniq
- end
- string = '<div class="footer_area"><center>Contact Us- +91665865753 Mobile - +91 324 878 994 Email - [email protected] or [email protected]</br>';
- pp extract_emails_to_array(string)
- pp extract_numbers_to_array(string)
Advertisement
Add Comment
Please, Sign In to add comment