Regular Expression on tool output
| From: | Jim MacDiarmid | Date: | Fri, 27 Feb 2004 15:45:39 +0000 |
| Subject: | Regular Expression on tool output | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23009@lists.php.net to get a copy of this message | ||
Hi Everyone,
I'm still very new to this regular expression thing and I'm hoping
someone can offer some help. I've been able to match parts of this but
now I'm at a loss. A little background on this. I'm running a console
EXE tool to generate some output to display currently logged in users in
all chat rooms on a server. The original output looks like the
following:
--- Cut here ---
OnLive! Operator Console (version 0.9.8) for 'XXX.XXX.XXX.XXX' starting.
Trav2.http://travelersnetwork.net/mystery/newentrance.dsv..72ac012d
HAS 1 space
"NEW ENTRANCE" AT ha97:3060:3062 HAS 6 users
zebratwo
OHMYHEAD
ºBÃB¥º TÑ-SysOp
Ç¥ç£ôp§ *TÑT§*
ÑÏÇK °TÑT§°
WÁNÐÅ °TÑT§°
Trav2.http://travelersnetwork.net/dominic/gateway.dsv..b1829958
HAS 0
spaces
OnLive! Operator Console for 'XXX.XXX.XXX.XXX' signing off.
--- Cut here ---
1. The first and last lines I'm shifting off the top and bottom of the
string, and are not being used in my regular expression.
2. I need to filter/parse out the urls in each line that has
"http://travelersnetwork.net/mystery/newentrance.dsv"
as well as the
digit count, as in "HAS 1 space" or "HAS 0 spaces".
3. I need to filter/parse out the room names such as "NEW ENTRANCE", as
well as the user count, as in "HAS 6 users".
4. I need to filter/parse out the user name list below each room line.
So the grouping as well as variable grouping would be as follows:
Space Url and space count
room name room count
user list
room name room count
user list
room name room count
user list
room name room count
user list
The logic is as follows:
---- Begin Logic
If space count is greater than or equal to 1
parse this space list
If room count is greater than or equal to 1 then
parse this room user list
else check/parse next space
Else check/parse next space
---- End Logic
Each space group can have 0 or more spaces ("rooms")
Each room group can have 0 up to 20+ users.
I hope all of this is clear enough to understand.. If anyone has any
questions, please do not hesitate to ask.
Thank you all so much for any help you can give. I greatly appreciate
it.
Jim