thank you for helping answer.

well why not using !~ ? because it's a configuration value, accepting regexp and a do know the pattern for excluding values from a array. my "real problem script" does work with real data.

by now i first try to understand perl functions .. perlref Lookaround Assertions as you already noted. first of all any tests with positiv lookahaed ($var =~ /a(?=string)/) work as expected.

negativ lookahead did not work as expected. let's focus on:
("gugus" =~ /gu(?!gu)/) ==> <gugus> found ("gu", "gu", "s")
and
("gugis" =~ /gu(?!gi)/) ==> <gugis> nomatch (undef, undef, undef)
do not solve the same. was using your proposal to dump match array. great idea, thank you

use strict; use warnings; use Data::Dump; my @var1 = ('gugu', 'gugus', 'and gugut for','gugas and', 'gurit for', +'granit') ; my @var2 = ('gugi', 'gugis', 'and gugit for','gugas and', 'gurit for', +'granit') ; my ($ret, $match); print ("get any string 'gu' not followed by 'gu'\n"); foreach (@var1) { $ret = $_ =~ /gu(?!gu)/p; $match = $ret eq 1 ? 'found' : 'nomatch'; print "<$_> $match "; dd ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH}; } print ("\nget any string 'gu' followed by 'gi'\n"); foreach (@var2) { $ret = $_ =~ /gu(?!gi)/p; $match = $ret eq 1 ? 'found' : 'nomatch'; print "<$_> $match "; dd ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH}; }
and now i'm about to transfer this problem into Test::More.

In reply to Re^2: regex negativ lookahead by SwissGeorge
in thread regex negativ lookahead by SwissGeorge

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.