sugi Posted December 27, 2004 Share Posted December 27, 2004 There's nothing like "don't count this group as a group" at least in the GNU implementations I know. Maybe because usually 10 groups are enough. Link to comment Share on other sites More sharing options...
CyberSlug Posted December 27, 2004 Share Posted December 27, 2004 So what do the others do instead? Besides, I have been creating my own original implementation here, so what enhancements we want, we can add. Yes, I am trying to stay as close to other implementations as I can, but we need to make this our own. <{POST_SNAPBACK}>I guess I'm used the search-and-replace reg expression support in editors such as TextPad and SciTE, so anything that would help accomplish that would be good.By the way, I think ^ and $ are missing from the docs. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 27, 2004 Administrators Share Posted December 27, 2004 Nope, but it is on the RegExp to do list that I plan to work on in the new year. I want to get array initializing done first, though. Maybe a debug version after that.My original name was that, but it made some of the related commands (no longer present) have huge names. I changed the name and stuck it in the middle of the registry commands in the function list. I do not have a problem if Jon wants to rename it.I'd quite like the regex replace function to be the next priority. It's one regex function that I can actually imagine using Seeing how much it gets used it PHP ( like on every other line) has made me see a lot of potential for it.The Dim thing and debug things are just nice-to-haves IMHO. 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...
Nutster Posted December 28, 2004 Author Share Posted December 28, 2004 I guess I'm used the search-and-replace reg expression support in editors such as TextPad and SciTE, so anything that would help accomplish that would be good.By the way, I think ^ and $ are missing from the docs.<{POST_SNAPBACK}>Oops. I know that ^ and $ are working, but I guess I left the documentation incomplete. Could someone fix the docs for me as I will not be working on this for at least a week. Ask Jon how much I enjoy documenting my work. I'd quite like the regex replace function to be the next priority. It's one regex function that I can actually imagine using Seeing how much it gets used it PHP ( like on every other line) has made me see a lot of potential for it.The Dim thing and debug things are just nice-to-haves IMHO.<{POST_SNAPBACK}>I can do that. Flag for global replacement. I guess I could add that flag for RegExp as well, instead of (or maybe as well as) ! on a group to supress reporting it in the array. 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...
LazyCoder Posted December 28, 2004 Share Posted December 28, 2004 Well, hello everybody.First of all thank you for AutoIt v3, it's a great tool I use with real pleasure .As I used to develop Perl scripts, I'm particularly interested in regular expression use. So, as soon as you included regexp functions, I happened to test and use them.You recent changes made me rewrite my matching error management but that's the bill to pay to use the last (beta in fact, I know) release of AutoIt v3. But the main points of this message are:1 - Some of my regular expressions are still matched but even if my pattern contain a group, I can't retrieve anything, my $aMatches variable never happen to be an array whereas more simple test show me that your RegExp function works the way you say.2 - From the beginning, I'm asking me why you didn't choose to use any already released C++ library to offer regular expression management... (such as this one for instance)For 1), I'm still working on it and I think/hope I'll make this work. But 2) is a real question to you... A good program computing A into B is mostly one that won't crash in all the other cases... Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 28, 2004 Administrators Share Posted December 28, 2004 2 - From the beginning, I'm asking me why you didn't choose to use any already released C++ library to offer regular expression management... (such as this one for instance)Lots of reasons. A few are- It's massive (the library above looks to be about 2MB alone). Lots of stuff in Autoit is custom written purely for size reasons. I could have used zlib for aut2exe compression but even that is too big for what we need. Instead I wrote a 2-3KB compression routine instead.- At the moment all code in AutoIt has been custom written for AutoIt. I like this. I don't intend to use 3rd party code unless there is no alternative. If nothing else it makes licensing decisions more simple. 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...
LazyCoder Posted December 28, 2004 Share Posted December 28, 2004 Thanks for your answer: things get clearer this way. As a consequence, I'll help you as much as I can on this particular regexp subject. PS: I fully agree regarding the size aspect... A good program computing A into B is mostly one that won't crash in all the other cases... Link to comment Share on other sites More sharing options...
Nutster Posted December 28, 2004 Author Share Posted December 28, 2004 Well, hello everybody.You recent changes made me rewrite my matching error management but that's the bill to pay to use the last (beta in fact, I know) release of AutoIt v3. But the main points of this message are:1 - Some of my regular expressions are still matched but even if my pattern contain a group, I can't retrieve anything, my $aMatches variable never happen to be an array whereas more simple test show me that your RegExp function works the way you say.<{POST_SNAPBACK}>Can you give me some specific examples that do not work the way you expect? I will look at them next week when I get home. 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...
LazyCoder Posted December 29, 2004 Share Posted December 29, 2004 Nothing better than a little sample... So here we go with those 2 files (code + the file to be read).RegExpBug.zip A good program computing A into B is mostly one that won't crash in all the other cases... Link to comment Share on other sites More sharing options...
Nutster Posted December 30, 2004 Author Share Posted December 30, 2004 I plan on adding a flag to the call of StringRegExp (the new name) to indicate whether the return value should be the array of group text, or just a true/false and to indicate whether to do a global search or not.Flag:0 - Return true/false1 - Return array of first set of matching groups.2 - Global search, but return true or false. Slower, but same behaviour as 0.3 - Return array of all matching groups. Note that one set does not start before the previous one ends.What do people think? 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...
LazyCoder Posted December 30, 2004 Share Posted December 30, 2004 Well, sounds good to me... A good program computing A into B is mostly one that won't crash in all the other cases... Link to comment Share on other sites More sharing options...
trids Posted December 30, 2004 Share Posted December 30, 2004 (edited) [..]Flag:0 - Return true/false1 - Return array of first set of matching groups.2 - Global search, but return true or false. Slower, but same behaviour as 0.3 - Return array of all matching groups. Note that one set does not start before the previous one ends.What do people think?<{POST_SNAPBACK}>Sounds good: but what is a "Global Search" (2)? And can you expand a bit on (3) please - does this mean when you have nested groups? Edited December 30, 2004 by trids Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 30, 2004 Administrators Share Posted December 30, 2004 I plan on adding a flag to the call of StringRegExp (the new name) to indicate whether the return value should be the array of group text, or just a true/false and to indicate whether to do a global search or not.Flag:0 - Return true/false1 - Return array of first set of matching groups.2 - Global search, but return true or false. Slower, but same behaviour as 0.3 - Return array of all matching groups. Note that one set does not start before the previous one ends.What do people think?Yeah, with the default (and if no flag is present) of just a true/false. I might try and get win titles working with regexps as well, that would be pretty cool. (from the code it looks like I just pass NULL for the variant pointer to not bother with the array return?) 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...
Nutster Posted December 30, 2004 Author Share Posted December 30, 2004 Sounds good: but what is a "Global Search" (2)? And can you expand a bit on (3) please - does this mean when you have nested groups?<{POST_SNAPBACK}>Ok there are two flags: Array return (1 - return array of strings with status in @Error, 0 - return true false, @error = 0 or 2 [screwed up pattern]) and Global search (2 - global search for matches, 0 - single search for matches). Add together the flags you want. Due to this distinction, the global search and the single search will both succeed or fail with the same strings, but the global search takes longer. Do not bother using global search with just a true/false return.Yeah, with the default (and if no flag is present) of just a true/false. I might try and get win titles working with regexps as well, that would be pretty cool. (from the code it looks like I just pass NULL for the variant pointer to not bother with the array return?)<{POST_SNAPBACK}>WinGetTitle? Very Cool! Yet another option for that function. As far as calling CRegExp::compare(), yeah, just give it a NULL in the array pointer to not store anything. Instead of returning the array, return the result of the compare() call. This could screw up my implentation of back-referencing, but I will fix it when I add the feature. 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...
trids Posted December 31, 2004 Share Posted December 31, 2004 I think I have it now: an array-return (flag=1) provides all the groups in the first match of a pattern; and a global array-return (flag=1+2) provides all the groups wherever the pattern matches. So a flag=3 returns a 2D array .. right? .. I must have been very dof yesterday! Link to comment Share on other sites More sharing options...
Nutster Posted December 31, 2004 Author Share Posted December 31, 2004 I think I have it now: an array-return (flag=1) provides all the groups in the first match of a pattern; and a global array-return (flag=1+2) provides all the groups wherever the pattern matches. So a flag=3 returns a 2D array .. right? <{POST_SNAPBACK}>flag = 3 = 1 + 2. It returns nothing at the moment. I am planning to just tack onto the end of the existing 1-dimensional array with the global search group matches (a lot easier). 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...
trids Posted December 31, 2004 Share Posted December 31, 2004 flag = 3 = 1 + 2. It returns nothing at the moment. I am planning to just tack onto the end of the existing 1-dimensional array with the global search group matches (a lot easier).<{POST_SNAPBACK}>Easier ? Wouldn't it be easier to interpret the results from a 2D array? Imagine a scenario where you have some text and you want the last IP address that appears in it. Sure, you can use an offset to interpret it as a 2D array .. but the last time I did this was when I was writing games for a Commmodore-64 I guess if it's lots of (internal) code to provide a 2D array, then we can always simulate it with a UDF .. we can document the results as a "retro-array" Link to comment Share on other sites More sharing options...
Valik Posted January 15, 2005 Share Posted January 15, 2005 David, how does one go about using the {x,y} feature? I've tried this but it doesn't work: $string = 12 $res = StringRegExp($string, "([0-9]{2})") If Not @error Then MsgBox(4096, "", $res[0]) It doesn't work, however. Link to comment Share on other sites More sharing options...
CyberSlug Posted January 15, 2005 Share Posted January 15, 2005 (edited) Might be a bug because the following works:$string = 12$res = StringRegExp($string, "([0-9]{2,2})")If Not @error Then MsgBox(4096, "", $res[0]) Edited January 15, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Valik Posted January 15, 2005 Share Posted January 15, 2005 Might be a bug because the following works:$string = 12$res = StringRegExp($string, "([0-9]{2,2})")If Not @error Then MsgBox(4096, "", $res[0])<{POST_SNAPBACK}>Thanks, I didn't think to try that one. I couldn't get any combination of things to work, but you're right, that method does. 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