Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!fernwood!uupsi!cmcl2!adm!news From: RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) Newsgroups: comp.unix.questions Subject: How do I find a word? Message-ID: <26716@adm.brl.mil> Date: 30 Apr 91 21:41:24 GMT Sender: news@adm.brl.mil Lines: 16 I get the feeling there's no good answer to this question, but I am asking it anyway... Is there a SIMPLE, NON-PAINFUL way to set up a regular expression so that it will match a given string only when it occurs as a word, i.e., delimited by non-alphanumeric characters or by line boundaries? In other words, I am looking for a simple, generalized way to find "foo" when it occurs as "foo bar" or "foo-bar" or "foo: bar" but NOT as "foobar". I am hoping there is a simpler answer than: "[^A-Za-z0-9]foo[^A-Za-z0-9]" Thanks to anyone who can help. Richard Smith - RSS@CALSTATE.BITNET