Jump to content



Photo

_DOSWildcardsToPCRegEx

Wildcards PCRE Regular Expression

  • Please log in to reply
3 replies to this topic

#1 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,081 posts

Posted 06 March 2009 - 07:03 PM

_DOSWildcardsToPCRegEx (+GUI)

Posted Image


While I've posted an earlier version of this elsewhere (I will redirect to here don't worry), I figured I might as well provide a GUI interface to expose what this function does and returns, and allow its results to be copied/pasted elsewhere (like to AgentRansack, a free file-search tool supporting PC Regular Exp​ressions). So here you'll find both the GUI interface and the UDF itself.

What it does: Takes a DOS wildcard exp​ression (ex: '*.*','*.jp*g','logfiles.l?g') and converts it into a PC Regular Exp​ression. This function in its original form, _FileMatch() was originally created by RobSaunders. I altered it a bit so that it will match files just as a 'Dir' command would.

It has the potential to be used for other types of comparisons as well, but you'll need to understand that it's results will probably need to be tweaked for whatever your intentions are. If you'd like to experiment with it's results, you can try using the String Regular Exp​ression Tester (by Szhlopp), the RecursiveFileSearch (#1 version) (by WeaponX) function (which is the reason I initially worked on it), or like mentioned above, AgentRansack, a free file-search tool.

GUI interface included that does the work for you!

Download the ZIP at my Site


Ascend4nt's AutoIT Code License agreement:
While I provide this source code freely, if you do use the code in your projects, all I ask is that:
  • If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I credit
  • If the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)
  • The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.
  • Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.

Edited by Ascend4nt, 14 September 2011 - 02:51 AM.








#2 ptrex

ptrex

    Universalist

  • MVPs
  • 2,400 posts

Posted 06 March 2009 - 08:43 PM

@ascendant

Good to know I am not the only one using "AgentRansack".

Maybe we should develop our own "AgentRansack" since they stopped the free version Edition.

Nice and usefull !

Regards,

ptrex

Edited by ptrex, 06 March 2009 - 08:48 PM.


#3 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 07 March 2009 - 02:07 AM

That is very nice!! Now if you could write it so that it can figure out my regex for every project to know how to parse structures and div's and such from different structures like html and plain text and geesh, I could go on forever.. LOL Very nice job...

#4 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,081 posts

Posted 07 March 2009 - 07:35 AM

Thanks guys!

@ptrex, AgentRansack rocks :D , but hmm.. I'd rather buy their FileLocatorPro version than develop my own! Plus there's a few projects here I believe that do searches. Maybe not PCRE searches, but well.. what can you do. I don't think AutoIt is suited for searching text in files though :unsure:

@gseller - Hah, funny. That's actually part of the fun of Regular Expressions - figuring them out! There's actually a few places I can recall that help you build them.. heck, even AgentRansack has a type of expression-builder.. but I've found it more fun to figure them out! Maybe I'm a masochist though :P





Also tagged with one or more of these keywords: Wildcards, PCRE, Regular Expression

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users