Regex to pull data from invokte-webrequest

Welcome Forums General PowerShell Q&A Regex to pull data from invokte-webrequest

  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by
    Participant
    .
Viewing 1 reply thread
  • Author
    Posts
    • #174832
      Participant
      Topics: 52
      Replies: 86
      Points: 25
      Rank: Member

      Hello, I have a simple invoke-webrequest command that looks like the following:

      `$site = invoke-webrequest https://website.com`

       

      Which when looking at the content field returns:

      >html<
      >body<
      >font size='+2'<
      texthere>/font<
      >/body<
      >/html<

      (i added them with the inverse tags to allow them on the page…not sure how to post HTML as a string here)

      I imagine I could use something like regex to grab the contents between <font and the </font> but I’m not really well versed in regex.

      Is this the best method to retrieve the string between font tags? Or is there a better method?

       

    • #174856
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      Is this the best method to retrieve the string between font tags?

      That pretty much depends on your exact requirements and the existing data. You should start to try and when you get stuck you should post your code here and we will try to help you as good as it’s get.

      As posted in the very first post on top of the list of posts in this forum (Read Me Before Posting! You’ll be Glad You Did!) You can’t paste HTML or XML. Ever. Use a Gist instead or it won’t show up in your post.

Viewing 1 reply thread
  • The topic ‘Regex to pull data from invokte-webrequest’ is closed to new replies.