Administrators Jon Posted January 21, 2005 Administrators Share Posted January 21, 2005 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...) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted January 21, 2005 Share Posted January 21, 2005 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. Link to comment Share on other sites More sharing options...
Nutster Posted January 21, 2005 Share Posted January 21, 2005 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"? David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
Valik Posted January 21, 2005 Share Posted January 21, 2005 But what happens on no extension? File names don't have to have an extension, after all. Link to comment Share on other sites More sharing options...
DaveF Posted January 21, 2005 Share Posted January 21, 2005 (edited) 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 Edited January 21, 2005 by DaveF 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. Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 21, 2005 Author Administrators Share Posted January 21, 2005 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") Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted January 21, 2005 Share Posted January 21, 2005 (edited) @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. Edited January 21, 2005 by SlimShady Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now