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
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Fri Mar 25, 2022 9:38 pm   

help with regular expsression
 
[GE|TE|PFS|PE|IPP|TRS|EG]

how do i turn that into a regular expression that will show just 1 or 100 of those ?

[GE]
[TE|GE]
[PE|GE|TE]

etc etc... it has too close of a pattern to use wildcard and picks up everything else in brackets. ~[(*)~]

it occurs in the middle of a pattern so it's not the beginning or end of a line and i tried this : ^~[(*)~]$

many thanks!
Reply with quote
shalimar
GURU


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

PostPosted: Fri Mar 25, 2022 11:49 pm   
 
Use the broad pattern, then test the resultant variable for the member you care about

Code:
#TR {~[(*)~]} {
  #IF (%ismember("GE", %1)) {do something}
  #IF (%ismember("TRS", %1)) {do something}
   //etc
  }
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Sat Mar 26, 2022 5:05 am   
 
Going to assume you want to toggle certain ones on/off based on some criteria. I ended up just doing a blanket capture...
Code:
<trigger priority="1640" regex="true" id="2070">
  <pattern>C: \[(\w[^>]+)(K|M)] \[(\w[^>]+)]</pattern>
  <value>HUD.Credits = %1
HUD.Value = %2
HUD.ActiveImplants = %3
#GAG</value>
</trigger>

used in
Code:
<button type="Separator" autosize="false" width="200" height="33" autopos="false" left="0" top="-183" toolbar="4" color="black" textcolor="aqua" border="red" priority="603" id="2063">
  <caption>Active Implants [Max: @HUD.ActiveMax] %cr [ @HUD.ActiveImplants ]</caption>
</button>


this was ages ago when I was more active with Cyborg though...

also for Shalimar's trick enable 'repeat within line' option so it will grab all active implants.
https://imgur.com/a/7mChXyr
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