Wildcard * is missing when concatenated with a variable

Things you’d like to miss in the future...
Forum rules
When reporting a bug, please include the following information: your XYplorer version (e.g., v27.90.0047), your Windows version (e.g., Win 11), and your screen scaling percentage (e.g., 125%). We recommend adding your Windows version and screen scaling percentage to your profile or signature. This will make debugging much easier for us.
Post Reply
altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Wildcard * is missing when concatenated with a variable

Post 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.

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Wildcard * is missing when concatenated with a variable

Post by highend »

Dereferencing, consult the help file…
One of my scripts helped you out? Please donate via Paypal

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: Wildcard * is missing when concatenated with a variable

Post 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?

admin
Site Admin
Posts: 64838
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Wildcard * is missing when concatenated with a variable

Post by admin »

I'd say that's a bug. :bug: :tup: Fixed in next beta.

altoclef
Posts: 87
Joined: 12 Oct 2012 18:54
Location: Win10 @100%

Re: Wildcard * is missing when concatenated with a variable

Post by altoclef »

Confirmed fixed in v.26.90.0106. Thanks. :tup:

Post Reply