Not being a regexp man I need some help.
What would the StringRegExp expression be to match "blah.txt - Notepad" but wouldn't match "Untitled - Notepad".
(I know it's a trival example, but I'm, erm, experimenting with something...)
Need help with regexp
Started by
Jon
, Jan 21 2005 06:54 PM
6 replies to this topic
#2
Posted 21 January 2005 - 07:17 PM
Uhhh... wow. Thats kind of hard. I don't claim to be an expert on regular expressions or anything so I may be missing something obvious, but... wow, thats kind of hard. It seems to me like there should be some way to negate a group. For example, this would match (if it worked): "(^Untitled) - Notepad". That would say "match anything but Untitled". However, thats not implemented and I'm not entirely sure if it should be.
#3
Posted 21 January 2005 - 07:54 PM
What about:
"[.]txt - Notepad"
This would match the .txt at the end of the file name. If you want to match any extension how about "[.].*- Notepad"?
"[.]txt - Notepad"
This would match the .txt at the end of the file name. If you want to match any extension how about "[.].*- Notepad"?
David NuttallNuttall Computer ConsultingAutoIt allows me to re-invent the wheel so much faster.An Aquarius born during the Age of AquariusI'm off to write a wizard, a wonderful wizard of odd...
#4
Posted 21 January 2005 - 08:08 PM
But what happens on no extension? File names don't have to have an extension, after all.
#5
Posted 21 January 2005 - 09:13 PM
In classic regexps you'd use something like:
/\w[.]w{2,3} - Notepad/
...to insure that before the " - Notepad" there was a file name of at least one character, a dot and a one-or-two character extension. If it's a concern that the party might have extensions hidden then the only thing I know that you could do is verify that the title isn't "Untitled - Notepad"...
[EDIT] grammatical error
/\w[.]w{2,3} - Notepad/
...to insure that before the " - Notepad" there was a file name of at least one character, a dot and a one-or-two character extension. If it's a concern that the party might have extensions hidden then the only thing I know that you could do is verify that the title isn't "Untitled - Notepad"...
[EDIT] grammatical error
Edited by DaveF, 21 January 2005 - 09:14 PM.
Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.
#6
Posted 21 January 2005 - 10:10 PM
Ok ok. I didn't really want to get into details I just wanted something simple that I could test with.
Opt("WinTitleMatchMode", 4) WinWaitActive("regexp=[.].*- Notepad")
#7
Posted 21 January 2005 - 10:19 PM
@Jon:
I have been thinking about RegExp and window title matching before.
I have read several times that a regular expression search will use more resources than any other function.
I'm wondering if StringRegExp can return within 250ms.
Because if the window is closed during the process strange things would happen (?)
Edit:
I just saw you added that in. I will test it out now.
I have been thinking about RegExp and window title matching before.
I have read several times that a regular expression search will use more resources than any other function.
I'm wondering if StringRegExp can return within 250ms.
Because if the window is closed during the process strange things would happen (?)
Edit:
I just saw you added that in. I will test it out now.
Edited by SlimShady, 21 January 2005 - 10:20 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





