I'm new at PowerShell and thanks to this forum I was able to grab data from my weather station to be used in my home automation system and it works very well.
Now I need to look at the forecast to display in my home automation touchscreen and to prevent watering if the chances of rain are over 50% for example.
I wrote a script to import forecast from NOAA and it's lots of HTML codes.
I want to extract everything from Tonight to the next <br> and save it in a text file:
The file content looks like this:<table width="670" border="0" align="left" cellpadding="0" cellspacing="0"><tr valign ="top"><td valign="top" align="left" colspan="2"><br>Tonight: A 50 percent chance of showers, mainly after 1am. Cloudy, with a low around 53. East northeast wind between 3 and 7 mph. New rainfall amounts of less than a tenth of an inch possible. <br>....
I really need help :)
Thank you
[regex]::matches($html,'(Tonight.*)(?=)')[0].value | Out-File weather.txt
Here is what I did
$html = Get-Content "C:\forecast.txt"
[regex]::matches($html,'(Tonight.*)(?=)')[0].value | Out-File C:\weather.txt
It creates a file from Tonight to the end of the file, I'm very close but I'm sure I'm missing lots of things, darn newbie
Continuing poking Powershell.com
This one work well, Thank you RMCK
Now I need to limit the extraction to the next "<br> <br>" I tried to modify RMCK's line but all I did was to create an error generator lol
[:'(] Everything I try fails... I'm sure there is way to do it but I'm too green to even think about a solution.
Anyone can help?
No one?