Jump to content

Recommended Posts

Posted

I am trying to grab "CVS.IST.LO.NA.CUPD" from the text below

Current context: CVS.IST.LO.NA.CUPD

User: ERTTT

Name: ERTTT

Name: UT_442

creatorsName: CN=CONRLS

Given Name: Eddie

Group Membership: ACCESS_BROWFS15_TEAMS_DBA.CDS

Group Membership: PC_SUPPORT.CDS..

here's what i have so far but not quite there yet.... what am i missing?

$current_context = StringRegExp($novell_output, "($i)($s)(?x)current context[:ascii:\S]", 1, $ofs)
_ArrayDisplay($current_context)
Posted (edited)

$current_context = StringRegExp($novell_output, "($i)($s)(?x)current context[:ascii:\S]", 1, $ofs)
_ArrayDisplay($current_context)

It looks like you can simplify things a bit:

$current_context = StringRegExp($novell_output, "(?i)current context: [:alnum:.]+", 1)
_ArrayDisplay($current_context)
Breakdown:

Changed the ($i) to (?i) because I believe it to be a typo.

Removed the (?s)(?x) because you don't need to match newlines (in fact a newline terminates the string you want), and there is not comments to worry about, and whitespace is important to matching "current context" correctly.

Based on you example, I changed :ascii: to :alnum:, to avoid weird punctuation sneaking in.

Also I changed \S to . as that was the separator in your record. I think that was the functionality you were looking for because \S duplicates the :ascii: group. \s is whitespace, which is what I think you were going for.

$ofs is optional, and doesn't appear to play into this particular case.

Hope this helps :mellow:

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Posted

@fulano,

I believe the offset to be a leftover from a regexp answer I made to a previous post, where I needed the feature.

@gcue,

regexp are very logical (even if I'm not the only one to admit they can be tricky at times) and the nice thing is: they never bite you, I mean physically. So don't get afraid to spend some time playing with them, experimenting from simple ones to more complex, throwing new quantifiers and constructs as you progress. RegExCoach is perfect for that.

The PCRE page link in the help page of StringRegExp is a definitive precise guide explaining everything in detail. Just forget about pure Perlisms at the end.

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