Jump to content

Recommended Posts

Posted

Hey jchd,

First of all, I like your avatar. Here are two examples that return empty strings.

dRun: [ctfmon.exe] c:\windows\system32\CTFMON.EXE

O20 - AppInit_DLLs: C:\PROGRA~1\Google\GOOGLE~3\GOEC62~1.DLL

Strings in which the file name contains both upper and lower case characters parse properly. Example:

O20 - Winlogon Notify: GoToAssist - C:\Program Files\Citrix\GoToAssist\514\G2AWinLogon.dll

Here is the RegExp I used:

'\A.*\\(.*?\.(?:exe|dll)).*\z'

Hopefully you'll see something that the rest of us must. In my case it's very easy for me to miss things in a RegEx because I truly am a newbie as far as that goes. I'm having fun learning that sometimes it seems like it's one step forward and two steps back. I imagine that everyone goes through the same thing but it doesn't make it any less frustrating. LOL Hope you're having a great weekend. -- SCB

[font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]

Posted

Put (?i) at the beginning of the expression to make it case insensitive.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Hi George,

I did as you suggested and place the ?i at the beginning of the RegEx, thus:

'?i\A.*\\(.*?\.(?:exe|dll)).*\z'

When I did that, ALL of the lines returned an empty string.

I also tried putting it here:

'\A.*\\?i(.*?\.(?:exe|dll)).*\z'

and here:

'\A.*\\(.*?\.?i(?:exe|dll)).*\z'

The results are still the same. The return is an empty string. When I leave ?i out altogether, everything returns correctly except for those file names which contain all uppercase characters. File names with both upper and lower case characters returned correctly.

At this point, my thinking is that a.) Since I really am a newbie as far as Regular Expressions go, I'm just missing something or b.) There's something odd going on between my code and me AutoIt interpreter. I'm certain that sooner or later the issue will be resolved. In the meantime, I'll be continuing to work on other aspects of this Google search function.

Hope you had a great weekend. -- SCB

[font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]

Posted

You see you would have saved much of your efforts simply by looking 2 minutes at the StringRegExp page in the helpfile.

The case-insensivity switch in PCRE is (?i) or in plain english: left parenthesis, question mark, lowercase i, right parenthesis.

So '(?i)\A.*\\(.*?\.(?:exe|dll)).*\z' should work for you.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

Hey jchd,

Fact of the matter is that I actually did look at the help file. What I didn't realize was that the parentheses were part of the flag. Thank you for pointing that out to me. I expect that it probably isn't the last time I'll make a mistake like that. ***big sigh*** Oh, well, that's the way we learn. Seems like there ought to be an easier way, doesn't there? -- SCB

[font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]

Posted (edited)

When you are looking at the SRE help page, the Round braces, curly braces and square braces all have a special meaning. Not like in the regular functions where square braces imply optional parameters. If you need to use them as literal strings in the SRE then they must be escaped with \

EDIT: Around here we all know you can't win for losing. I really should have quoted that as "(?i)" but then it's a sure bet you would have tried to include the quotes too.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

:idea: George, aren't you a bit rude?

@ SpotCheckBilly

Serious, you'll find that regular expressions can be a very powerful way to process text, but they need some sweat first and can be a bit frustrating on occasion even to long-term users. They are found in decent editors, most text processors (MS Word) and a large number of tools as well. There come in several flavors but once you grasp the basics, you add a convenient blade to your pocket knife. Google, search the forum, try by yourself and learn. It's worth the effort.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

Perhaps, but it wasn't aimed at anyone in particular including SpotCheckBilly. Just a comment based on experience and anyone who has been around here for a while can testify to the validity of said comment.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

@George:

"...it's a sure bet you would have tried to include the quotes too. ..."

I suspect that you are probably right. LOL :)

@jchd -- I get a glimmer of an idea just how useful Regular Expressions can be as I rework my original block of code for my Google Search UDF. At approximately halfway through the task I've been able to get rid of probably around two thirds of my original code by using that one small RegEx. I would imagine that will be equally true when I start working on my database query.

Thanks so much everyone. I truly appreciate your insight. You folks are the best and I'm pretty certain I will be back with more questions -- and by pretty certain I mean no doubt about it. -- SCB :idea:

[font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]

Posted

You're welcome. Ride regexps like waves (but don't forget your safety belt!)

Don't forget there are SQL veterans here as well.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...