Jump to content

Recommended Posts

Posted (edited)

I want to have have a string(Variable) in the pattern part of my SRE and be able to also have some normal pattern after.

(If that made no sense I well show you what I mean)

This is what i have,

$Word = String("Hello")

$asResult = StringRegExp($1, $Word & '([sS]+?)(x2e|x29|x3b)', 3)

But when i run the program it just returns the occurrences of $Word and not the rest of the pattern.

I would also like to be able to if it finds a ";" (aka x3b) also looks for $Word again.

I'm gonna have over 100 words in the $Word String, so listing them twice could make it almost impossible for me to be able to check.

If this isn't possible please let me know!

Edited by dropoff510
Posted

dropoff510,

Like this?

;
;

#include <array.au3>

$word = "hello;goodbye;what;the;end;when;I;an;elephant;end;dog"

$s_word010 = "end"

$result = StringRegExp($word,"what|" & $s_word010 ,3)

_arraydisplay($result)

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

dropoff510,

You seem to like to make simple things look hard!

$str = String("abc") is the same as $str = "abc"

[sS]+? is the same as .+?

x2e|x29|x3b is the same as [.);]

This is the third post about your regexp problem and still you use confusing wording to explain what you have (the typical subject string) and what you want to get (capture). I and others are more than willing to help you but without you being clear about your context and expectations we can only guess things by trying to read your mind. It wastes our time and is counter-productive for you.

So please, provide a short but significant real world input including more than one line if you need to along with a list of expected captures. Try putting a clear meaning to what you want to capture exactly.

Then we might come up with a working pattern and explain you how it works so that the next time you need to regexp something you don't start again from scratch.

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...