Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Mar 2010 12:43:49 +1030
From:      itbs@internode.on.net
To:        <freebsd-questions@freebsd.org>
Subject:   Need some regex help - Guru's?
Message-ID:  <35046.1269828829@internode.on.net>

index | next in thread | raw e-mail

[-- Attachment #1 --]
 Case in point regarding the server. Please cc me as I'm not 
subscribed via this account, and I can't receive for the same reason I 
can't send- damn Yahoo! 
 
 If anyone can help though it would be much appreciated- on both the 
regex or the yahoo problem :) 
 
 Cheers 
  
[-- Attachment #2 --]
From freebsd-questions@herveybayaustralia.com.au Mon Mar 29 11:20:27 2010
Subject: Need some regex help - Guru's?
From: Da Rock <freebsd-questions@herveybayaustralia.com.au>
To: freebsd-questions@FreeBSD.ORG
Content-Type: text/plain
Message-ID: <1269825626.4955.431.camel@laptop1.herveybayaustralia.com.au>
Mime-Version: 1.0
X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port 
Date: Mon, 29 Mar 2010 11:20:27 +1000
X-Evolution-Format: text/plain
X-Evolution-Account: 1262636400.15832.0@laptop1.herveybayaustralia.com.au
X-Evolution-Transport:
 smtp://freebsd-questions@mail.unitedinsong.com.au/;use_ssl=never
X-Evolution-Fcc: mbox:/home/admin/.evolution/mail/local#Outbox/Sent
Content-Transfer-Encoding: 8bit

I know this is a little OT, but it is regarding the sysadmin of
FreeBSD :) I'm also *still* having trouble with the freebsd servers not
being able to find my hostname from time to time - despite arguing
incessantly with yahoo who have no support except for their mail system,
and tell me talk to my postmaster to sort it out: which is me.

I'm building some php scripts to help with administration of ldap for
user accounts, etc. It is supposed to read in the schema from cn=config
for editing (something which they decided to say the hell with it and
store it as a blob).

I'm stuck on some PCRE regex for this (eg.):

{1}( DynGroupOC:1 NAME 'dgIdentityAux' SUP top AUXILIARY MAY
( dgIdentity $ dgAuthz ) )

What I'm trying to achieve is to run a matchall to get this:
[0] DynGroupOC:1
[1] NAME 'dgIdentityAux'
[2] SUP top
[3] AUXILIARY
[4] MAY ( dgIdentity $ dgAuthz )

My regex looks like this atm:
(?:(?:[^\{0-9\}])(?:[0-9]+\.?)+|(?:(?:\w+):(?:[0-9]+\.?))[^
\s])|([A-Z]{3,}(.*[^A-Z]))

Now the first part works; which obtains the OID in either the form of
decimal delimited numeric string or OID macro. The only exception to
this is the above example - for some reason it won't recognise this
macro format, but it did pick out the others such as:

{0}( NetscapeLDAPobjectClass:33 NAME 'groupOfURLs' SUP top STRUCTURAL
MUST cn MAY ( memberURL $ businessCategory $ description $ o $ ou $
owner $ seeAlso ) )

It successfully picked out NetscapeLDAPobjectClass:33 exactly as it was
supposed to. It also picks up the whole OID in numeric string perfectly.

I'm really having even more trouble with the second part: I cannot for
the life of me get it to pick out the capitalised attribute and its
possible value. It is determined to make my life difficult and grab the
string after the OID.

So I now come on my knees to a regex guru who can show me a way to do
this or what I'm missing or, even better, a more effective way to obtain
what I need...

Cheers
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35046.1269828829>