On Tue, Jan 02, 2001 at 02:24:22PM +0100, Tollef Fog Heen wrote:
> | s/[0-9]*//
> | s/part$/disc/
> 
> What is the use of the first s/?  Unless your first letter is a digit,
> it will just remove the zero-width string '' between the first / and
> the beginning of the string.
> 
> A better solution will probably be to 
> 
> s/[0-9]$//
> 
> which will remove 5 from /dev/hda5.

You seem to know that $ and ^ anchor a match to the end or the beginning
of a string. So you should also know that in the absence of one of
these characters, the match may start anywhere in the string. So the
statement works fine as it is.

However, stylistically s/[0-9]*// is better written as s/[0-9]+//
because the case where no digits match is better classified as
"not a match".

-- 
The idea is that the first face shown to people is one they can readily
accept - a more traditional logo. The lunacy element is only revealed
subsequently, via the LunaDude. [excerpted from the Lunatech Identity Manual]


Reply via email to