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 3 months ago by
    Participant
    .
Viewing 1 reply thread
  • Author
    Posts
    • #174832
      Participant
      Topics: 51
      Replies: 86
      Points: 12
      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 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: 1
      Replies: 1632
      Points: 3,075
      Helping Hand
      Rank: Community Hero

      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.