AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[RegExMatch] Notworking when passing a variable?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
eXistenZ
Guest





PostPosted: Wed Nov 28, 2007 10:21 am    Post subject: [RegExMatch] Notworking when passing a variable? Reply with quote

When I try this:
Code:
RegExMatch("    Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 0:1 DAR 0:1], 25.00 fps(r)", "i)[0-9]{2,4}x[0-9]{2-4}", test)
MsgBox, %test%

things work perfectly, i get 720x576 as a result.

When I try this however;
Code:
dimensions = "    Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 0:1 DAR 0:1], 25.00 fps(r)"
RegExMatch("%dimensions%", "i)[0-9]{2,4}x[0-9]{2-4}", test)
MsgBox, %test%


the messagebox stays empty, and so does the %test% variable!

What am I doing wrong? I believe this is a bug.

Gtz,

eXistenZ from Holland
Back to top
BoBoĻ
Guest





PostPosted: Wed Nov 28, 2007 2:42 pm    Post subject: Reply with quote

Code:
dimensions = "    Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 0:1 DAR 0:1], 25.00 fps(r)"
RegExMatch(dimensions, "i)[0-9]{2,4}x[0-9]{2-4}", test)
MsgBox, %test%
?
Back to top
eXistenZ
Guest





PostPosted: Wed Nov 28, 2007 3:43 pm    Post subject: Reply with quote

Doesn't seem to work...
Back to top
FGR
Guest





PostPosted: Wed Nov 28, 2007 4:54 pm    Post subject: Re: [RegExMatch] Notworking when passing a variable? Reply with quote

eXistenZ wrote:
When I try this:
Code:
RegExMatch("    Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 0:1 DAR 0:1], 25.00 fps(r)", "i)[0-9]{2,4}x[0-9]{2-4}", test)
MsgBox, %test%

things work perfectly, i get 720x576 as a result.

This code also does not work,there is a syntax error, you wrote "{2-4}" and not "{2,4}".
Correct it and Bobo's code will work.
Back to top
eXistenZ
Guest





PostPosted: Mon Dec 03, 2007 11:29 am    Post subject: Reply with quote

the - isn't the problem i know i mistyped there Wink Still not working...
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2472
Location: Australia, Qld

PostPosted: Mon Dec 03, 2007 12:33 pm    Post subject: Reply with quote

Since '=' is for assigning literal text, the quote marks are included in the assigned value. Use ':=' to assign the string.
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Dec 03, 2007 12:41 pm    Post subject: Reply with quote

It works for me,even with the "="
Back to top
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Dec 04, 2007 1:28 pm    Post subject: Reply with quote

eXistenZ wrote:
Still not working...
Works for me...
Note that = works but just includes the double quotes in the string. Which isn't a problem here.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group