[INUG-Users] Regex Help Please
Hubbard, Greg L
greg.hubbard at eds.com
Tue Sep 4 15:11:38 EDT 2007
Well, you could try the "extract($string,"Component=([^;]+);") form and
see if that works -- this should mean "grab everything that is not a
semicolon".
GLH
________________________________
From: users-bounces at netcoolusers.org
[mailto:users-bounces at netcoolusers.org] On Behalf Of Gaurav Nangia
Sent: Tuesday, September 04, 2007 1:58 PM
To: users at netcoolusers.org
Subject: [INUG-Users] Regex Help Please
To All:
I have the following string coming in -
$string = OperationallyDown::Component=PORT-SWA20FL01/5.26
[marc];Type=ETHERNETCSMACD;OperStatus=DOWN;InterfaceCode=CODEUNKNOWN;Dup
lexMode=FULLDUPLEX;AdminStatus=UP;LastChangedAt=04-Sep-2007 1:06:44
PM;IsFlapping=false;MaxSpeed=100000000;Mode=NORMAL
I am trying to extract the string "Operationally Down" and all
text after the Component= up to the 1st semi-colon. The text string
after that can change - i.e. in the example above it is Type= but it can
be anything else and I am only looking for only the component portion.
My extract regular expression is -
$category = (extract ($string, "^(.*)\:\:Component=.*\;")
$component = (extract ($string,
"^.*\:\:Component=(.*)\;[a-zA-Z]+=.*\;")
I have also tried - $component = (extract ($string,
"^.*\:\:Component=(.*)\;")
The $category works fine, but the $component grabs everything
after Component=.
What am I doing wrong?
Thanks,
Gaurav Nangia
The Depository Trust & Clearing Corporation
Management and Network Security
(212) 855 - 2317
________________________________________________________
DTCC DISCLAIMER: This email and any files transmitted with it
are confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email in
error, please notify us immediately and delete the email and any
attachments from your system. The recipient should check this email and
any attachments for the presence of viruses. The company accepts no
liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the Users
mailing list