Showing posts with label Regular Expressions. Show all posts
Showing posts with label Regular Expressions. Show all posts

Saturday, November 26, 2011

Developer with too many privileges.

The forums are getting totally out of hand at times.
If you look at the thread in Developer Chat regarding updateing the StringRegExp GUI you will see that it is now locked.  That comes from someone who has recently become a Developer.  Unfortunatly that also gives said person Moderator priveledges.  It was locked simply because I answered that I wouldn't be doing any changes to it.  That reply was in response to the question in this thread.
http://www.autoitscript.com/forum/topic/134937-improvements-for-stringregexpgui/page__view__findpost__p__942231
It had nothing to do at all with the person who locked it.  Now we have a Developer who gets into a huff and decides that the RegEx GUI will not be part of the next release.  While I personally don't think it should be part of the AutoIt install that does not mean that everyone will feel the same way.  That was a personal statement and was placed in the post as a reason that I wouldn't be working on that code at all.  In my opinion, that old GUI needs too much work to bring it up to what is really needed for an effective tool.  That is one that will test everything properly and be easy for beginners to use.
While it is no major loss since there are a few other scripts/apps that do the job and do it better in my opinion that is no reason for the attitude shown in the last post of the thread.

Several of the recent developments both in the forums and in AutoIt itself already have me considering whether or not I should even continue with updating AutoIt as new versions become available.  Again this is personal.  I know that others think that functionality should continually be expanded but as far as I'm concerned it has already far surpassed it's primary goals.  Do we need all of the extras?  That depends on what you are using AutoIt for.  I don't.  If the Developers want to go down this road then perhaps it's time for them to start working on AutoIt4.  That way they won't be breaking any existing code because it won't be compatable at all anyway.  They will also have the advantage of being able to restart with well written code based on experience instead of constantly having to either modify base code (that's taking a chance) or having to use clumsy workarounds because of the short comings of the current base.  By the Developers own admission, if they had to do it all over again, the base code would not be the mess it is now.  Take all the GUI code as an example.  The primary developer doesn't want to touch it because of the mess it's in.  That being the case, starting from scratch would seem reasonable.  Throw the old code out the Window.
AutoIt3 is in no way compatable with AutoIt2 so why would anyone worry about  AutoIt4 being compatable with AutoIt3?  There is no need for that and new goals can be set at the time development is started so they know what will have to be done.  Take the new COM code as an example.  It broke a lot of UDF's which had to be fixed.  As far as I remember I only have one UDF using COM at all so it's no big deal.  I don't use or support that UDF anymore so I'll just remove it from my site.
Speaking of my AutoIt site(s) stay tuned for major changes.  The way I'm looking at it right now is this.
My AutoIt online help site will be taken down and temporarily replaced with a re-direct to the official online help site so you won't have the navigation abilities any longer.  That will probably happen within the next couple of days.  The main AutoIt site will undergo major changes.  All that will remain is a list of links to the actual script files and any compiled apps including the PCRE Toolkit.

I still don't have enough time for much forum activity (see the previous post on this blog) and I think with the way things are going right now there is a good chance that I won't be bothered even signing in for much longer.  I have too many things on the go to be worrying about other peoples attitudes and whether or not I might be stepping on thier toes.
Remove a Developers moderator priveledges and I might reconsider, remove the developer and I will probably reconsider.  For now that's all I intend to say about the subject.
Feel free to comment; you won't hurt my feelings at all and it won't change my feelings towards you if I have any.  Here, unlike the AutoIt forums we do have freedom of speech and I'm always willing to listen to a reasonable argument.

Sunday, July 4, 2010

Update for PCRE Toolkit ia available

There is an update now available for the toolkit.
Download v3.0.0.24 here

There are a few new features and several bug fixes.

Sorry but the help file is still not available, hopefully I will have time to get that done soon.

Friday, June 11, 2010

PCRE Toolkit for AutoIt RELEASED

At long last the first release version of the PCRE Toolkit for AutoIt is available for public download.

If you are planning on working with regular expressions then this may be the only tool you need.

Download it now.

The help file is not yet ready but since you are a developer you should be able to figure it out.
Please post any comments you may have or suggestions for improvement.  I'm also looking for comments about whether the help file should be included with the install or a separate download.

I hope you enjoy using it more than I've enjoyed creating it.

Update:  Gone now are most of the control tool tips in favor of displaying the information in the status bar.

PCRE Toolkit updated again

See this post
This is mainly a cosmetic update but a couple of minor bugs were also fixed.

Thursday, May 6, 2010

PCRE Toolkit Question

I've been asked why the database for the libraries uses binary data.  The answer is simple enough, because of some characters used in the Regular expressions, databases wouldn't play nicely so there were 2 possible solutions.
  • Use Binary
  • Escape the stored data
The second may have been a bit more user friendly since it would allow the user to edit the data directly in the database, however the binary method was one that I'm very familiar with and has worked well in the past.  I now have a couple of simple escape functions (compliments of jchd) for the database and I may indeed switch to method 2 at some point in the future.  There is definitely no rush because anything that should be edited by the user can be done with the edit button on the Library tab.  The new version includes a new database table that includes some application settings and the editor does not have access to that table.

Another question.
Why can't I delete the Samples library?  You can as long as it's not the default library.  In order to do that, at least one other library must exist and you must change the default to a different library.

Whats in store for the next release?  Hopefully I'll get rid of the Up/Down buttons and make it so you can move an item just by dragging it where you want it to go.  I'm also considering having new libraries available for download at some point and that may be started in time for the next release.  I'm also going to attempt to get at the much hated documentation.

Enjoy what there is and check back for changes.

You can either report bugs to me through a PM in the AutoIt forums or by leaving comments on this blog.

Monday, May 3, 2010

PCRE Toolkit Beta

Announcement:
The newest beta release of the toolkit is now available for download.  Currently only available as an installer file.  The source code is available by request only.

Available at
http://dundats.mvps.org/beta/pcretest.zip

Extract the Setup.exe file from the Zip and install it.
Stay tuned, there are yet more features in progress and I will update the file as they are completed.

What's new? too many things to list but for openers, the button to make the selected library item the current expression is now gone.  Just double click the library item and it's taken care of.

Edit: Updated June 11, 2010 (mainly cosmetic)
Edit: Updated June 04, 2010
    Now with a new tab for running commands using @ComSpec and reading the StdIO stream so you can check things like Ping 127.0.0.1
Edit:  Updated   May 19, 2010
Edit:  Updated   May 10, 2010
Download was updated May 06 /2010

Now with the ability to insert standard RegEx elements into your expression from the Expression>> Insert menus.

Tuesday, April 20, 2010

How do I ask a question about regular expressions?

We are getting more and more regular expression questions being asked and people have a tendency to not give us enough details to work with.  The best method is to post an example of the string you are working with and follow that with a list of the expected matches.  If you are refering to web page html code then either give us a link to  the page or post enough of the page that it includes all of the functional bits that you want to parse and that means some of the code on both sides of the element that you want to work with.

That gives us a starting point and you will usually get a working answer or an answer that is very close and only needs a bit of touch up to be what you want it to be.

Wednesday, April 14, 2010

More on regular expressions

Regular expressions are a very powerful tool, but they require a very precise understanding of what they are expected to accomplish. Regexps are a way to express complex rules in a compact way, but there must be rules to direct their behavior.  It's those rules that you have to take the time to learn, and it WILL take time.  Should you use regular expressions for all string search functions.  No, in general the native AutoIt string functions are faster than the regular expression method.
For example, you wouldn't use $sStr = StringRegExp("This is some string.", "(.+{7}", 1) when you can use
$sStr = StringLeft("This is some string", 7) to do exactly the same thing.
Now if it was a situation where for example the string contained digits that appeared at various locations in the string, the RegExp is better
$sStr = "This string 9085 contains digits at 7693 locations."
$sRtn = StringRegExp($sStr, "\d+", 3) will return both sets of digits
$sRtn = StringRegExp($sStr, "\d{3}", 3) will return the first 3 digits of each set
$sRtn = StringRegExp($sStr, ".*?(\d+).*", 1) returns the first set of digits
$sRtn = StringRegExp($sStr, ".*\D(\d+).*", 1) returns the last set of digits.

From this example you can see the power of SRE's compared to using native string functions.  A couple of those examples would likely have to be run through several native functions or would be impossible using anything except a regular expression.

I general, if you can do it in one or two simple native functions then do it that way.  If it's more complex, use the SRE.
I should also mention that when it comes to the speed differences, we are talking about micro-seconds in either case so it makes no noticeable difference unless you are doing hundreds or even thousands of iterations.

By the way, my new AutoIt regular Expression ToolKit is now ready for Beta testing so, if you want to help out, contact me through the AutoIt forums and the application is available here as a win32 installer in a zip file.

Saturday, April 3, 2010

StringRegExp()

Are you having a hard time catching on to the use of SREs?  You are not alone.  Since their very inception, regular expressions have been difficult for developers to learn.  One of the primary reasons is the fact that there are so many flavors of RegEx engines out there and a regular expression that works in Javascript (example only) won't necessarily work in .NET (example only) or AutoIt.

There are many Reg tools available but the big question with each is "What engine is the tool designed for."  Since we are primarily concerned with those that work with AutoIt, I will mention a couple that come close in most cases.
RegEx Buddy
RegEx Coach
Expresso

I have one that was originally released by a couple of forum members and I have been constantly modifying it to suit my purposes.  This one is explicitly for AutoIt and as far as I know has never been tested with any other language.  Since the engine used by AutoIt is the PCRE engine then it should also work with Perl but no guarantees there.  AutoIt has a few idiosyncrasies that make it just a touch different from normal PCRE regex's.  Right now I've only made this tool available by request via a PM.  That will change at some point and I'll make it available on one of my webs (that will most probably be my AutoIt Central site).  It will always continue to be free and open source as a way to partially pay back to the AutoIt community and in keeping with the intent of the original authors.  My hope is that there will be a public release within the next month but I must first do some more work on the snippet holder.  Originally a list control was used and I'm changing it to a listview instead.  I'm also hoping to get a menu included that will allow you to insert common matching code like (?i) and (?s) as well as the groups like [:alpha:] etc.

If you have specific issues with a regular expression, I suggest that you post it as a question in the AutoIt forums.  You will generally get a working version that does what you expected.

In the meantime don't get frustrated when you first attempt SREs.  The light will suddenly come on and you will be off to the races.  One thing that is becoming very pronounced is the tendency of some people to over think the regexp.  many are posting regular expression's which are far to complex for the situation at hand.  Keep it simple and you will have much more success.

If you are looking for a specific RegEx try searching on one of my favorite sites, The Regular Expression Library.
If you have any questions or suggestions for content on this post, please use the comments link.