[TriLUG] regex: match lines NOT containing X
Kevin Hunter
hunteke at earlham.edu
Wed Feb 22 11:05:17 EST 2012
At 10:10am -0500 Wed, 22 Feb 2012, Brian McCullough wrote:
> On Wed, Feb 22, 2012 at 09:56:07AM -0500, Kevin Hunter wrote:
>> I've needed this construct more than a few times, so I'm almost
>> sure it exists; I just don't know the right Google terms,
>> apparently. On the other hand, I could accept that this may not be
>> possible in a single step regex.
>
> Not being anything like a regex guru, I might do it something like
> "grep two x | grep -v heads" but that is rather simplistic.
Heh, I obviously did not say my full problem, nor did I fully specify my
problem. Thanks all for your responses so far.
The full problem is that I want to *do* something with line based on the
match. Akin to
if m/^(some_regex) other (stuff) [^but doesn't match this anywhere]/ {
...
It needs to both match one part, at the same time as not matching
anywhere the other part. The catch is that in this context, I have only
a single regex to do what I want. I do not have access to grep, and
this is unfortunately not Perl.
Cheers,
Kevin
More information about the TriLUG
mailing list