Non greedy pattern match in sed
Matthew Hawkins
matt at mh.dropbear.id.au
Wed Aug 14 16:55:04 EST 2002
Just nitpicking ;)
Kim Holburn (kim.holburn at anu.edu.au) wrote:
> "*" means multiple instances of (whatever came first in this case ".")
Actually "+" means multiple (1 or more) matches of the preceeding atom.
"*" means 0 or more. [1] Subtle but important difference.
Just to confuse things, in POSIX extended regular expressions, "?" means
0 or 1 matches (equivalent to {0,1}) of the preceeding atom, but is used
to specify a non-greedy match in Perl RE's.
You could go really nuts and try an expression like so:
/[[./*.]]([^[.*/.]])+[[.*/.]]/
[1] Assuming POSIX 1003.2 extended RE's
--
Matt
"So, logically, if she weighs the same as a duck, she's made of wood, and therefore a witch!"
(Monty Python and the Holy Grail)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20020814/a20a6109/attachment.bin
More information about the linux
mailing list