home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 619 / strsed / readme < prev    next >
Encoding:
Text File  |  1992-06-29  |  2.5 KB  |  74 lines

  1.  
  2. README for strsed
  3.  
  4. Strsed is another string function. It does regular expression search
  5. and replace (including tr(1)-like transliteration) in the style of the
  6. ed/edit/ex text editors.
  7.  
  8. Here are a few examples:
  9.  
  10.   (change "fred" to "joe")        strsed(s, "s/fred/joe/", 0);
  11.   
  12.   (change all "fred"s to "joe")   strsed(s, "g/fred/joe/", 0);
  13.   
  14.   (delete all a's)                strsed(s, "g/a//", 0);
  15.   
  16.   (change fred and what follows
  17.    to upper case)                 strsed(s, "s/fred.*/{a-z}{A-Z}/", 0);
  18.  
  19.   (strip repeated letters
  20.    in the ranges a-z and 0-9)     strsed(s, "g/\([a-z0-9]\)\1+/\1/", 0);
  21.  
  22.   (search for a number in s)      int range[2];
  23.                                   strsed(s, "/[0-9]*/", range);
  24.                                   /* indices of the matched portion are
  25.                                      returned in range[0] & range[1] */
  26.  
  27.  
  28. and there's more...  See the man page in 'strsed.3c' for details.  
  29.  
  30. It is general enough to be able to emulate most of the usual more
  31. complicated string functions (including strchr, strrchr, strpbrk,
  32. strspn, strcspn and strtok), and can perform complicated string
  33. manipulations that are otherwise a major headache.
  34.  
  35. The GNU regex package is needed for linking. The necessary source
  36. files are regex.c and regex.h which were included in the GNU 18.55
  37. (and 18.54) emacs distribution.  Both are expected to be in the
  38. current directory when you type 'make'.
  39.  
  40. Strsed is distributed with no conditions or guarantees attached. 
  41. Bear in mind however that the GNU license applies to the regex
  42. sources.
  43.  
  44. This was developed in a (basically) System V environment using gcc
  45. (1.37), but there should be no problem at all in compiling it on BSD
  46. or elsewhere - everything is very standard.
  47.  
  48. To compile, copy or link the GNU regex.{c,h} files into the current
  49. directory and type 'make'. If you do not have gcc then change the
  50. Makefile to use cc. Some compilers (NOT gcc) (notably MIPS' cc) have
  51. been known to have problems compiling regex.c into something that will
  52. run without coredumping.
  53.  
  54. This will produce 'strsed.o'. As well as this, two checking programs
  55. will be compiled and example files will be run. If all is well you
  56. will get the two messages:
  57.  
  58.   Substitution and transliteration tests passed successfully.
  59.   Searching tests passed successfully.
  60.  
  61. Indicating that things are OK.
  62.  
  63.  
  64.  
  65. Have fun...
  66.  
  67. Terry Jones 
  68. (terry@pcsbst.pcs.com or ...!{pyramid,unido}!pcsbst!distel!terry)
  69.  
  70. PCS Computer Systeme GmbH
  71. Pfalzer-Wald-Str 36
  72. 8000 Munchen 90
  73. West Germany       49-89-68004288
  74.