in reply to negative look behind (again)

Just try this below code

#! /usr/bin/perl use strict; use warnings; while (<DATA>) { chomp; if(/^TAG\d{1}.*TAG\d{1}.*/) { print ">>>$_<<\n"; } } __DATA__ TAG1 text one TAG2 etc TAG1 text two TAG2 etc TAG1 text three TAG2 etc TAGS text four TAG2 etc TAG1 text five TAGT etc TAGZ text four TAGX etc

Replies are listed 'Best First'.
Re^2: negative look behind (again)
by Anonymous Monk on Jan 21, 2014 at 10:18 UTC
    OK. Leslie. Your code works. But what I want is to make "negative look behind" work with this example. It's just to satisfy my knowledge...
      >perl -wMstrict -le "for ('TAG1 text one TAG2 etc', 'TAGS text ess TAG2 etc', 'TAG1 text two TAG2 etc', ) { print qq{'$_'} if m{ \A .... (?<! TAGS) .* TAG \d }xms; } " 'TAG1 text one TAG2 etc' 'TAG1 text two TAG2 etc'