Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

79
Views
What is the best method to copy all matching text from a web page?

Background I have a live web dashboard for ticket numbers and their status updates. Each update and case number are in separate rows on this web page. To make this dashboard useful, I have to save it as offline HTML and import it into excel to copy one row of data like all case numbers.

Goal How do I search for a matching string on a page and copy all to clipboard in separate lines? EG, all my case numbers match the first two digits like “12.......” If I can manage to figure that out, I can make use of text in tools easier like Trello etc.

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

You could do something like this with Python:

import re
import requests

text = input("Enter text: ")

url = requests.get('https://stackoverflow.com/questions/69691849/what-is-the-best-method-to-copy-all-matching-text-from-a-web-page').text
page = re.findall(text, url)

for i in page:
    print(i)

I don't think you'd be able to copy all the output, however you could just copy the output from command prompt. It's unclear what you are trying to fully achieve here.

Output:

Output with array ( print(page) ):

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.