[email protected]
[Top] [All Lists]

Regex for mc replace ?

Subject: Regex for mc replace ?
From: chris glur
Date: Sat, 2 May 2009 16:00:58 +0300
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,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.
Mc mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • Regex for mc replace ?, chris glur <=