|
Atreides096 Beginner
Joined: 26 Apr 2004 Posts: 15 Location: USA
|
Posted: Mon Feb 19, 2007 8:43 pm
Weird stringlist problem |
Trying to match a stringlist in a regular expression... I'm apparently doing something wrong, but can't figure out what I am doing wrong...
Code: |
#va tempvar {a|b|c|d}
#trigger {({@tempvar})$} {#say match} |
That works just fine. But then I've tried everything I can think of.. using zmud's conversion button, as well as:
Code: |
#regex {(?:@tempvar)}
#regex {(@tempvar)}
#regex {((?:@tempvar))}
#regex {(?:(@tempvar))} |
and so on, and none of them will match. My guess is that I am breaking a procedural rule rather than incorrect syntax... anyone know what I am doing wrong?
Thanks a lot :) |
|
|
|
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Mon Feb 19, 2007 10:17 pm |
try #REGEX {@{tempvar}} :P
|
|
|
|
Atreides096 Beginner
Joined: 26 Apr 2004 Posts: 15 Location: USA
|
Posted: Mon Feb 19, 2007 11:05 pm |
Didn't work, just did things like change my prompt to:
<HP: 13 (?)/130>0 {#addkey _SubsConfig Sanc Yes} |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon Feb 19, 2007 11:43 pm |
Code: |
#REGEX {\b(@tempvar)\b} {#say Matched %1}
#REGEX {\b(?:@tempvar)\b} {#say Matched} |
The first captures the value of the word and the second just matches without capturing. You shouldn't need the \b around it if you don't want to capture only whole words (i.e., you want sub-string matches). |
|
|
|
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Mon Feb 19, 2007 11:56 pm |
#VA v_b0 {a|b|c|d}
#TR {^(@{v_b0}) (.*)$} {#WIN debug b0 %2} "" {regex}
works for me, theres 'feature' in regex implementation, it wont take var names starting with _...
rephrase: so any sort of (?_varname:expression) will fail |
|
|
|
|
|