Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Driving the Engine right off the road

by tybalt89 (Monsignor)
on Aug 22, 2025 at 20:55 UTC ( [id://11166085]=note: print w/replies, xml ) Need Help??


in reply to Driving the Engine right off the road

/^(?<!XDG_) [_A-Z0-9]+ _PATH$/x does not make sense to me, you are trying to look before the beginning of the string.

How about:

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11166082 use warnings; my @patterns = qw/PKG_CONFIG_PATH XDG_DATA_DIRS XDG_SEAT_PATH XDG_SESS +ION_PATH/; my $re = qr/^(?!XDG_ [_A-Z0-0]+ _PATH$)/x; for ( @patterns ) { print /$re/ ? " match" : "no match", " $_\n"; }

Outputs:

match PKG_CONFIG_PATH match XDG_DATA_DIRS no match XDG_SEAT_PATH no match XDG_SESSION_PATH

Replies are listed 'Best First'.
Re^2: Driving the Engine right off the road
by ysth (Canon) on Aug 24, 2025 at 14:31 UTC
    That will also match "bob", which doesn't sound desired.

      It correctly performs on all the provided test cases. It's not my problem if an inadequate number of test cases are provided :)

        $string eq 'PKG_CONFIG_PATH' || $string eq 'XDG_DATA_DIRS'
        then? 😀

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2025-11-10 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (66 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.