Caolan asked,
I'm trying to make a regexp which will match any
line except a line that starts with "slot:" I've got
^([^s]|s[^l]|sl[^o]|slo[^t]|slot[^:]).* which matches any line that
doesn't have "slot:" in it, but lines that don't start with "slot:"
but nevertheless contain it are still matched by the regexp. Any
ideas ? It's got to be a regexp for other constraints.
Well, most if not all programs that interpret regexps have a means of
specifying what you want. For example, in vi (well, ex strictly speaking):
v/^slot:/
matches anything *except* "beginning of line followed by slot:", which is
what you want. Doing it purely in regexp is a pain in the arse, but you
shouldn't have to, because perl, sed, and every program I'm aware of that
uses regexps has this feature.
--
Paul Dunne | paul at dunne.ie.eu.org | http://dunne.yi.org/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!