Regex for mc replace ?

chris glur crglur at gmail.com
Sat May 2 13:00:58 UTC 2009


Regular expression encoding has got to be the most
annoying task ! And yet so essential.
Every system seems to have its own syntax. ?
We really should be able to use mc > F4 > F4
== Replace >  Enter search string:
to replace a line like
'original | [31]Report this message | [32]Find messages by this author'
  with, say, a <space>.
the following are my 'Enter search string:' attempts:
^orig    == FAIL. some systems use "^" for line start
orgin     == finds the next 'orgin'
orgin .9    == fail to find 'ogin' followed by <anyChar>*9
What I want is:
line starting with string 'orgin' followed by 40 to 80
<anyChar except line-terminator> followed by
string 'author'.
--------------
extract from man:-
  Regular Expressions
       Regular expressions are the extended kind found  in  egrep.   They  are
       composed of characters as follows:
......       .          matches any character including newline.
       ^          matches the beginning of a string.
       $          matches the end of a string.
       r+         matches one or more r's.
       r*         matches zero or more r's.
       r?         matches zero or one r's.
       (r)        grouping: matches r.
       r{n}
       r{n,}
       r{n,m}     One or two numbers inside braces denote an interval  expres-
                  sion.   If  there is one number in the braces, the preceding
                  regular expression r is repeated n times.  If there are  two
                  numbers  separated  by  a comma, r is repeated n to m times.
                  If there is one number  followed  by  a  comma,  then  r  is
                  repeated at least n times.
---------
What a can of worms ?!
Please advise.

== Chris Glur.



More information about the mc mailing list