Jump to content

Help with SRE


Recommended Posts

I want to have SRE search for a word(and other symbols) and then after, skip over everything until it finds a specific symbol, namely ")"

StringRegExp($1, '(Word)([0-9]{1,3})(?:\x2e|\x29|\x3b)', 3)

This is my code, I have figured out all the word and other symbols/Numbers, i just want to have it skip everything until it finds the ")"

Link to comment
Share on other sites

Then this should work by matching up to the first (not last) closing parenthesis (after your word, digits and symbols):

StringRegExp($1, '(Word)([0-9]{1,3})(?:x2e|x29|x3b).*?)', 3)

Simpler version:

StringRegExp($1, '(Word)([0-9]{1,3})[.);].*?)', 3)
Edited by jchd

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)

Link to comment
Share on other sites

In this simple regex, you should avoid the non-greedy operator, this should result in faster execution.

StringRegExp($1, '(Word)([0-9]{1,3})[.);][^)]*)', 3)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I used a different way that i figured out that seems to work because i needed to also stop an ")" ";" "." and any letter.

SringRegExp(Word)(.?*)(?:x2e|x29|x3b|[a-z]|[A-Z])

I know that it is a more complex way of doing it, but it makes more sence in my mind.

I used .?* which works fine except if, ")" ";" "." or letter, is on a newline.

i tried using ?s?* but then it doesn't return anything.

What should i use?

I'm not sure what you mean by non-greedy operators, the execution is already very fast.

Thanks for the advice though.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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