Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Xerakon
Apprentice


Joined: 10 May 2011
Posts: 111

PostPosted: Tue Jul 14, 2020 5:54 pm   

Pattern Matching Woes
 
Having a devil of a time matching this display:

Code:

Planet          Starsystem            Governed By               Popular Support
Nal Hutta       Y'Toub System         Neutral Government        (UFG)   100.0
Kashyyyk        Mytaranor Sector      Neutral Government        (UFG)   99.0
Mandalore       Mandalore Sector      Neutral Government           100.0
Korriban        Horuset System        Neutral Government           100.0
Lorrd           Kanz Sector           Neutral Government           100.0
Wroona          Wroona System         The Imperial Coalition       100.0
Ithor           Ottega System         Neutral Government        (UFG)   100.0
Arkania         Perave System         The True Imperium         (UFG)   100.0
Tatooine        Arkanis Sector        Neutral Government        (UFG)   100.0
Corellia        Corellian System      The Imperial Coalition    (UFG)   100.0
Ord Mantell     Bright Jewel Sector   The Imperial Coalition       100.0
Alderaan        Alderaan System       Aldera Peace Force        (UFG)   100.0
Ryloth          Gaulus Sector         Galactic Peacekeeping Force    (UFG)   100.0
Dac             Calamari System       Neutral Government           100.0
Coruscant       Corusca Sector        Neutral Government           100.0
Use SHOWPLANET for more information.


I only need to capture the first two values (planet and starsystem). I've tried various tokens to try and affect this. My latest attempt was with:


Code:
^(*) %s(*) %s*


This captures %1 as planet, starsystem, and governed by, and %2 as either nothing or (UFG).

I tried adding in a space before the %s to include 2/3-word values, but it just will not seem to capture. I've gotten close a few times with (%w), but this doesn't help with 2/3-word values.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Tue Jul 14, 2020 8:06 pm   
 
* is very greedy, give more solid anchor points like the anonymous variable in this one:

#TR {^(*) %s (* {System|Sector})} {$planet=%1;$system=%2}
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net