I'm trying to build a variable so if I have an inputselect box that has 3 choices and I choose check box 2, I want the result to be $1*$3, if I choose checkbox 3 the result would be $1$2*, or if I choose checkboxes 1 and 2 the result would be **$3 (or perhaps a single "*" instead of 2 wildcards in a row). The purpose of this is that I have a regex of several groups of characters and I want the checkbox to result in the use of the asterisk '*' to be a wildcard wherever I choose but keep the other variables (groups).
$1*$3 would be: group1*group3
$1$2* would be: group1group2*
**$3 would be: **group3
What I have so far, but am stuck.
Code: Select all
$source = inputselect("Choose an option:<crlf>(select only one) ", "1|2|3|4|5", , 2+8192, , 300, 262, Selection);
if ($source=="1") {
$result = "$1";
}
else {
$result = "*";
}
if ($source=="2") {
$result = "$result" . "$2";
}
else {
$result = $result . "*";
}
if ($source=="3") {
$result = "$result" . "$3";
}
else {
$result = $result . "*";
}