home *** CD-ROM | disk | FTP | other *** search
-
- README for strsed
-
- Strsed is another string function. It does regular expression search
- and replace (including tr(1)-like transliteration) in the style of the
- ed/edit/ex text editors.
-
- Here are a few examples:
-
- (change "fred" to "joe") strsed(s, "s/fred/joe/", 0);
-
- (change all "fred"s to "joe") strsed(s, "g/fred/joe/", 0);
-
- (delete all a's) strsed(s, "g/a//", 0);
-
- (change fred and what follows
- to upper case) strsed(s, "s/fred.*/{a-z}{A-Z}/", 0);
-
- (strip repeated letters
- in the ranges a-z and 0-9) strsed(s, "g/\([a-z0-9]\)\1+/\1/", 0);
-
- (search for a number in s) int range[2];
- strsed(s, "/[0-9]*/", range);
- /* indices of the matched portion are
- returned in range[0] & range[1] */
-
-
- and there's more... See the man page in 'strsed.3c' for details.
-
- It is general enough to be able to emulate most of the usual more
- complicated string functions (including strchr, strrchr, strpbrk,
- strspn, strcspn and strtok), and can perform complicated string
- manipulations that are otherwise a major headache.
-
- The GNU regex package is needed for linking. The necessary source
- files are regex.c and regex.h which were included in the GNU 18.55
- (and 18.54) emacs distribution. Both are expected to be in the
- current directory when you type 'make'.
-
- Strsed is distributed with no conditions or guarantees attached.
- Bear in mind however that the GNU license applies to the regex
- sources.
-
- This was developed in a (basically) System V environment using gcc
- (1.37), but there should be no problem at all in compiling it on BSD
- or elsewhere - everything is very standard.
-
- To compile, copy or link the GNU regex.{c,h} files into the current
- directory and type 'make'. If you do not have gcc then change the
- Makefile to use cc. Some compilers (NOT gcc) (notably MIPS' cc) have
- been known to have problems compiling regex.c into something that will
- run without coredumping.
-
- This will produce 'strsed.o'. As well as this, two checking programs
- will be compiled and example files will be run. If all is well you
- will get the two messages:
-
- Substitution and transliteration tests passed successfully.
- Searching tests passed successfully.
-
- Indicating that things are OK.
-
-
-
- Have fun...
-
- Terry Jones
- (terry@pcsbst.pcs.com or ...!{pyramid,unido}!pcsbst!distel!terry)
-
- PCS Computer Systeme GmbH
- Pfalzer-Wald-Str 36
- 8000 Munchen 90
- West Germany 49-89-68004288
-