From: William James Date: 2006-03-10T20:13:42+09:00 Subject: Re: Small regexp question francisrammeloo@hotmail.com wrote: > Hi all, > > I am writing some refactoring code for a C++ project. > > I need to change: > > class MyClass > { > ... > } > > to: > > class IMP_EXP MyClass > { > ... > } > > The pattern I used to find a class definition line is: > > line =~ /^\s*class\s+(\w+)/ > > But I want to exclude forward class declarations ( class MyClass; ) > > So I changed my pattern to: > > line =~ /^\s*class\s+(\w+)\s*[^;]/ --> don't match if line ends > with ";" > > But it doesn't work... Why? > > I ended up using: if line !~ /;/ and line =~ /^\s*class\s+(\w+)/ > > Hints? > > Any help will be appreciated, > Best regards, > > Francis /^\s*class\s+(\w+)\s*$/