Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- randomtext = """(381) 3222985
- uncled@mac.com
- retina_logo.svg
- mar_adine@outlook.com
- 0049 515 6828458
- +381 2056848
- Nature2345.jpg
- paley@yahoo.ca
- drolsky@sbcglobal.net
- <h2>Subtitle</h2>
- kmiller@yahoo.ca
- scottlee@com.cast.net
- <a href=“javascript::”>Click Me</a>
- homework.pdf
- kohlis@optonline.net
- (387) 547-2359
- guialbu@live.com
- 00387 901-813
- animals.png
- +385 260-7825
- sjmu.ir@opton-line.net
- kramu_lous78@yahoo.com
- 00387 547-2469
- netsfr@yahoo.ca
- +387 232693
- Logo.png
- carroll@hotmail.com
- <div class=“col-md-12”>Title</div>
- loading.gif
- <p>Some nice paragraph</p>
- debest@outlook.com
- <div>Test</div>
- <a href=“mailto:test_mail@gmail.com”>Contact Me!!</a>
- """
- #print([x[0] for x in re.findall("(.*(381|387).*)\n", randomtext)])
- #print(re.findall("<.*>(.*)</.*>", randomtext));
- #print([x[0] for x in re.findall("(.*\.(img|png|svg|gif))\n", randomtext)])
- lines = randomtext.split("\n");
- numbers = []
- for line in lines:
- if(re.match(".*(381|387).*", line)):
- numbers.append(line)
- print(numbers);
- html = []
- for line in lines:
- if(re.search(">.*<", line)):
- html.append(re.search(">(.*)<", line).group(1))
- print (html)
- images = []
- for line in lines:
- if(re.match(".*.(img|png|svg|gif)", line)):
- images.append(line)
- print(images)
- # def numbers(text):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement