Skip to main content

Getting an Excuse

Here is a quick way of getting a good excuse – provided you have Internet access:

#requires -Version 3
function Get-Excuse
  $url = ''
  $ProgressPreference = 'SilentlyContinue'
  $page = Invoke-WebRequest -Uri $url -UseBasicParsing
  $pattern = '(?m)<br><font size = "+2">(.+)'
  if ($page.Content -match $pattern)

It illustrates how you can use Invoke-WebRequest to download the HTML content of a webpage, then use regular expressions to scrape content from that page.

Twitter This Tip! ReTweet this Tip!

Posted Feb 17 2016, 06:00 AM by ps1


I am the one