Anyone who can speak RegEx: I'd like a measure that can get the latest Mega Millions result and the draw date from the reputable source of your choice. - Please
I have tried to do RegEx captures and I'm crap at it.
I'd like it if I could optionally get some historical results as well but that's not really a big deal overall.
Thanks in advance
It is currently May 4th, 2024, 9:24 am
Looking for a RegEx script to get the latest Mega Millions Result
-
- Posts: 48
- Joined: November 6th, 2019, 4:19 am
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Looking for a RegEx script to get the latest Mega Millions Result
Yincognito, knock! knock!
P.S. at first I thought he was asking to store a million matches parsed using regex.
P.S. at first I thought he was asking to store a million matches parsed using regex.
from the Realm of Death
-
- Posts: 48
- Joined: November 6th, 2019, 4:19 am
Re: Looking for a RegEx script to get the latest Mega Millions Result
Only if it shows which one is the winner (before the drawing)
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Looking for a RegEx script to get the latest Mega Millions Result
API Documentation(get an api key to not get temporarily blocked):
https://dev.socrata.com/foundry/data.ny.gov/5xaw-6ayf
API format:
https://data.ny.gov/resource/5xaw-6ayf.json?draw_date=2005-07-12T00:00:00.000
Code: Select all
[Date]
Measure=Time
Format=%Y-%m-%d
[Regex]
Measure=WebParser
URL=https://data.ny.gov/resource/5xaw-6ayf.json?draw_date=[Date]T00:00:00.000
RegExp=.*"winning_numbers":"(.*)".*,.*"mega_ball":"(.*)".*
UpdateRate=(3600*12)
[WinningNumbers]
Measure=WebParser
URL=[Regex]
StringIndex=1
[MegaBall]
Measure=WebParser
URL=[Regex]
StringIndex=2
from the Realm of Death
-
- Posts: 48
- Joined: November 6th, 2019, 4:19 am
Re: Looking for a RegEx script to get the latest Mega Millions Result
I can't get this to work - I did mention that I'm crap at regex
I haven't seen any variation of this expression actually return any data
This is what I have after much testing / tweaking / and mucking about... (date measure works, url works)
I haven't seen any variation of this expression actually return any data
This is what I have after much testing / tweaking / and mucking about... (date measure works, url works)
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
[Variables]
[MegaMill]
Meter=String
X=200
Y=22
W=400
H=40
;MeasureName=Date
MeasureName=DrawDate
;MeasureName=WinningNumbers
;MeasureName=MegaBall
;MeasureName=Multiplier
SolidColor=202020DF
FontSize=18
StringAlign=CenterCenter
FontColor=DFDFDFFF
AntiAlias=1
DynamicVariables=1
Text=%1
[Date]
Measure=Time
Format=%Y-%m-%d
DynamicVariables=1
[Regex]
Measure=WebParser
URL=https://data.ny.gov/resource/5xaw-6ayf.json?draw_date=2021-08-17T00:00:00.000
RegExp=.*draw_date:"(.*)",.*"winning_numbers":"(.*)".*,.*"mega_ball":"(.*)".*,.*multiplier:"(.*)".*
UpdateRate=(3600*12)
[DrawDate]
Measure=WebParser
URL=[Regex]
StringIndex=1
DynamicVariables=1
[WinningNumbers]
Measure=WebParser
URL=[Regex]
StringIndex=2
DynamicVariables=1
[MegaBall]
Measure=WebParser
URL=[Regex]
StringIndex=3
DynamicVariables=1
[Multiplier]
Measure=WebParser
URL=[Regex]
StringIndex=4
DynamicVariables=1
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Looking for a RegEx script to get the latest Mega Millions Result
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0
[Variables]
DrawDate=2021-08-17
[Regex]
Measure=WebParser
URL=https://data.ny.gov/resource/5xaw-6ayf.json?draw_date=#DrawDate#T00:00:00.000
RegExp=.*"draw_date":"(.*)".*"winning_numbers":"(.*)".*,.*"mega_ball":"(.*)".*"multiplier":"(.*)"
UpdateRate=3600
[DrawDate]
Measure=WebParser
URL=[Regex]
StringIndex=1
[WinningNumbers]
Measure=WebParser
URL=[Regex]
StringIndex=2
[MegaBall]
Measure=WebParser
URL=[Regex]
StringIndex=3
[Multiplier]
Measure=WebParser
URL=[Regex]
StringIndex=4
[MegaMill]
Meter=String
MeasureName=DrawDate
MeasureName2=WinningNumbers
MeasureName3=MegaBall
MeasureName4=Multiplier
SolidColor=202020DF
FontSize=18
StringAlign=
FontColor=DFDFDFFF
AntiAlias=1
DynamicVariables=1
Text=Draw Date: "%1"#CRLF#Winning Numbers: "%2"#CRLF#MegaBall: "%3"#CRLF#Multiplier: "%4"
Edit:
Ohh I see it now. You forgot to put double quotes("") around draw_date.
from the Realm of Death
-
- Rainmeter Sage
- Posts: 7198
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Looking for a RegEx script to get the latest Mega Millions Result
Ouch, missed this one, sorry 'bout that... Took a little break from checking things here. I suppose the issue is solved by now, isn't it?death.crafter wrote: ↑August 18th, 2021, 4:48 pm Yincognito, knock! knock!
P.S. at first I thought he was asking to store a million matches parsed using regex.
If so, thanks, death.crafter, for managing the regexes like a boss while I was hiding myself from the outside world, LMAO.
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Looking for a RegEx script to get the latest Mega Millions Result
Lol, except .s and *s I am a pro noob in regex. Tho I take credit for "Googling" out the website.Yincognito wrote: ↑August 19th, 2021, 5:59 pm Ouch, missed this one, sorry 'bout that... Took a little break from checking things here. I suppose the issue is solved by now, isn't it?
If so, thanks, death.crafter, for managing the regexes like a boss while I was hiding myself from the outside world, LMAO.
from the Realm of Death
-
- Rainmeter Sage
- Posts: 7198
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Looking for a RegEx script to get the latest Mega Millions Result
I use RegExr.com to build or verify stuff - I like that it looks simpler than regex101.com, and it was invaluable in my regex experiences. It's a lot like Rainmeter's docs, with the left sidebar for strict to the point, no nonsense, help (i.e. RegEx Reference) and the large and comfortable "Expression" and "Text" area in the middle, plus the "Replace" and "List" buttons at bottom right. Can't apply multiple substitutions like in Rainmeter, but I copy paste results as "texts" to other similarly pinned tabs to replicate that.death.crafter wrote: ↑August 19th, 2021, 6:01 pm Lol, except .s and *s I am a pro noob in regex. Tho I take credit for "Googling" out the website.
-
- Posts: 48
- Joined: November 6th, 2019, 4:19 am
Re: Looking for a RegEx script to get the latest Mega Millions Result
Yes - it turned out pretty well, thanks for the Regex assist.
Thx also for the RegExr.com reference. I might actually get the hang of PCRE
Thx also for the RegExr.com reference. I might actually get the hang of PCRE
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
DrawDate=2021-08-17
[Regex]
Measure=WebParser
URL=https://data.ny.gov/resource/5xaw-6ayf.json?draw_date=2021-08-17
RegExp=.*"draw_date":"(.*)".*"winning_numbers":"(.*)".*"mega_ball":"(.*)".*"multiplier":"(.*)".*
UpdateRate=(3600*12)
[DrawDate]
Measure=WebParser
URL=[Regex]
StringIndex=1
RegExpSubstitute=1
Substitute="T00:00:00.000":""
[WinningNumbers]
Measure=WebParser
URL=[Regex]
StringIndex=2
[MegaBall]
Measure=WebParser
URL=[Regex]
StringIndex=3
[Multiplier]
Measure=WebParser
URL=[Regex]
StringIndex=4
[MegaMill]
Meter=String
MeasureName=DrawDate
MeasureName2=WinningNumbers
MeasureName3=MegaBall
MeasureName4=Multiplier
SolidColor=202020DF
FontSize=18
Padding=15,8,15,8
FontColor=DFDFDFFF
AntiAlias=1
DynamicVariables=1
InlineSetting=Color | DFDF00FF
InlineSetting2=Weight | 600
InlineSetting3=Size | 24
InlinePattern=" \d\d\n"
InlinePattern2=" \d\d\n"
InlinePattern3="\d\d \d\d \d\d \d\d \d\d \d\d\n"
Text=%1#CRLF#%2 %3#CRLF#Megaplier x%4