home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!pipex!warwick!coventry!ccx018
- From: ccx018@cch.coventry.ac.uk (Leslie Griffiths (Griff))
- Subject: A regexp quickie
- Message-ID: <BsyqJs.HIz@cck.coventry.ac.uk>
- Summary: How to express a certain pattern
- Keywords: regexp.
- Sender: news@cck.coventry.ac.uk (news user)
- Nntp-Posting-Host: cc_sysh
- Organization: Coventry University
- Date: Fri, 14 Aug 1992 07:38:15 GMT
- Lines: 31
-
- Hi folks, I have a quick regexp query. Does anyone know how one would express
- the regexp 'a word, surrounded either by whitespace OR at the beginning of a
- line and ending in white space.'
-
- e.g.
-
- white
-
- or
-
- white
-
- Its easy to express either of these
-
- /^.*[ ]*/
-
- and
-
- /[ ][ ]*.*[ ][ ]*/
-
- But how would one express both in a regexp.
-
- NOTE - I am using sed, so no full regexps, no | or +
-
- Cheers
-
-
- --
- Griff \\ ccx018@uk.ac.cov
- ^^^^^ :-= ^^^^^^^^^^^^^^^^
- //
-