Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 9th, 2012, 06:57 PM
ThatSamIam ThatSamIam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 3 ThatSamIam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 30 sec
Reputation Power: 0
Request Parsing Help

Hi,

This is what I would like to parse

Code:
Slot   Description                    State           Command         Status
============================================================================
C00    XLR Control Module(M)          diag on-line
O00    Optical Tributary Module       diag on-line
O01    Optical Tributary Module       diag on-line
O02    Optical Tributary Module       diag on-line
O03    Optical Tributary Module       diag on-line
O04    Optical Tributary Module       diag on-line
O05       -                           slot empty
O06       -                           slot empty
O07       -                           slot empty
O08       -                           slot empty
O09       -                           slot empty
X00    Optical Switching Module       diag on-line
X01    Optical Switching Module       diag on-line
X02    Optical Switching Module       diag on-line
X03    Optical Switching Module       diag on-line
X04    Optical Switching Module       diag on-line
X05    Optical Switching Module       diag on-line
X06    Optical Switching Module       diag on-line
X07    Optical Switching Module       diag on-line
X08    Optical Switching Module       diag on-line
X09       -                           slot empty
C01    XLR Control Module(S)          diag on-line
T00    Timing Sync Module             diag on-line
T01    Timing Sync Module             diag on-line


Here is what I think ought to work (but does not)
Code:
(?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,}(?<value>[\w\s-]*)


This partial expression works
Code:
(?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,} 


Even this works
Code:
(?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{3,}(?<value>[\w-]*)


Your help will be appreciated.
(Note: there may be other "States".)

ThatSamIam

Reply With Quote
  #2  
Old June 12th, 2012, 07:47 PM
spacebar208's Avatar
spacebar208 spacebar208 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: spaceBAR Central
Posts: 188 spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level)spacebar208 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 9 h 5 m
Reputation Power: 41
Ok, I see your input but what do you want your output to look like?

Reply With Quote
  #3  
Old June 12th, 2012, 09:06 PM
ThatSamIam ThatSamIam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 3 ThatSamIam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by spacebar208
Ok, I see your input but what do you want your output to look like?


Spacebar208,

Thanks for looking at this. At ~650 views and no responses, I was getting worried.

I would like:
Name, Value
(C00, diag on-line)
(O00, diag on-line)
(O01, diag on-line)
(O02, diag on-line)
(O03, diag on-line)
(O04, diag on-line)
(O05, slot empty)
(O06, slot empty)
(O07, slot empty)
(O08, slot empty)
(O09, slot empty)
(X00, diag on-line)
(X01, diag on-line)
(X02, diag on-line)
(X03, diag on-line)
(X04, diag on-line)
(X05, diag on-line)
(X06, diag on-line)
(X07, diag on-line)
(X08, diag on-line)
(X09, slot empty)
(C01, diag on-line)
(T00, diag on-line)
(T01, diag on-line)


Thanks again,
ThatSamIam

Reply With Quote
  #4  
Old June 14th, 2012, 01:19 PM
ThatSamIam ThatSamIam is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 3 ThatSamIam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 30 sec
Reputation Power: 0
Ok, I figured it out:

PHP Code:
(?<Name>[COXT]\d\d)\s+([\(\)\w]*\s)*-?\s{5,}(?<Value>(\w+[\s-]{0,1})*$) 


Thanks to those who gave it a shot.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Request Parsing Help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap