Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import re
  2.  
  3. randomtext = """(381) 3222985
  4. uncled@mac.com
  5. retina_logo.svg
  6. mar_adine@outlook.com
  7. 0049 515 6828458
  8. +381 2056848
  9. Nature2345.jpg
  10. paley@yahoo.ca
  11. drolsky@sbcglobal.net
  12. <h2>Subtitle</h2>
  13. kmiller@yahoo.ca
  14. scottlee@com.cast.net
  15. <a href=“javascript::”>Click Me</a>
  16. homework.pdf
  17. kohlis@optonline.net
  18. (387) 547-2359
  19. guialbu@live.com
  20. 00387 901-813
  21. animals.png
  22. +385 260-7825
  23. sjmu.ir@opton-line.net
  24. kramu_lous78@yahoo.com
  25. 00387 547-2469
  26. netsfr@yahoo.ca
  27. +387 232693
  28. Logo.png
  29. carroll@hotmail.com
  30. <div class=“col-md-12”>Title</div>
  31. loading.gif
  32. <p>Some nice paragraph</p>
  33. debest@outlook.com
  34. <div>Test</div>
  35. <a href=“mailto:test_mail@gmail.com”>Contact Me!!</a>
  36. """
  37.  
  38.  
  39. #print([x[0] for x in re.findall("(.*(381|387).*)\n", randomtext)])
  40. #print(re.findall("<.*>(.*)</.*>", randomtext));
  41. #print([x[0] for x in re.findall("(.*\.(img|png|svg|gif))\n", randomtext)])
  42.  
  43. lines = randomtext.split("\n");
  44.  
  45. numbers = []
  46. for line in lines:
  47. if(re.match(".*(381|387).*", line)):
  48. numbers.append(line)
  49.  
  50. print(numbers);
  51.  
  52.  
  53. html = []
  54. for line in lines:
  55. if(re.search(">.*<", line)):
  56. html.append(re.search(">(.*)<", line).group(1))
  57.  
  58. print (html)
  59.  
  60. images = []
  61. for line in lines:
  62. if(re.match(".*.(img|png|svg|gif)", line)):
  63. images.append(line)
  64.  
  65. print(images)
  66. # def numbers(text):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement