Page 1 of 1

Wildcard * is missing when concatenated with a variable

Posted: 22 Feb 2025 20:50
by altoclef

Code: Select all

$v = 'foobar';

    // Most characters can be concatenated with the variable, e.g.:
    $withHashAtBeginning = "#$v";
    msg "Hash at beginning: $withHashAtBeginning";

    $withFullStopAtBeginning = ".$v";
    msg "Full stop at beginning: $withFullStopAtBeginning";

    $withQuestionMarkAtBeginning = "?$v";
    msg "Question mark at beginning: $withQuestionMarkAtBeginning";
    
    // However, there seems to be an issue with the * wildcard character but only at the beginning:
    $withWildcardAtBeginning = "*$v";
    $withWildcardAtEnd = "$v*";

    msg "Wildcard at end: $withWildcardAtEnd";
    msg "Wildcard missing at beginning: $withWildcardAtBeginning", 48;

    // There is a workaround:
    $withWildcardAtBeginning = '*' . $v;  
    msg "Wildcard at beginning using workaround: $withWildcardAtBeginning";
Have I misunderstood something? It seems like a bug to me.

Re: Wildcard * is missing when concatenated with a variable

Posted: 22 Feb 2025 21:31
by highend
Dereferencing, consult the help file…

Re: Wildcard * is missing when concatenated with a variable

Posted: 23 Feb 2025 10:22
by altoclef
Thank you. I wasn't aware of the dereferencing operator. Please can you move this thread out of Bug Reports.

I mostly understand the concept. However, this is confusing me:

Code: Select all

$v = 'vampire'; $vd = '$v';

   aid 0;             // dereferencing not allowed
   text      " *$vd"; //  *$v       (as expected: asterisk character and contents of $vd)
   text ' ' . "*$vd"; //  vampire   (why is the asterisk being taken as a dereferencing operator?)

Could you explain the difference, please?

Re: Wildcard * is missing when concatenated with a variable

Posted: 23 Feb 2025 11:34
by admin
I'd say that's a bug. :bug: :tup: Fixed in next beta.

Re: Wildcard * is missing when concatenated with a variable

Posted: 23 Feb 2025 12:35
by altoclef
Confirmed fixed in v.26.90.0106. Thanks. :tup: