[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: autodetecting MBR location

*  (Colin Watson)

| Contrary to the subconscious assumption many people make, the first
| priority for a regex is to match earliest, not to match longest.
| regex(7) specifically mentions this:

For a non-POSIX regex, that 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".
| True; even s/\d+// or s/\d+$// (assuming that the partition numbers are
| always at the end, even in devfs - I'm not familiar with that).

s/\d+// on devfs devices is dangerous, you'll get rid of the host

perl -e '$_ = "/dev/ide/host0/bus0/target0/lun0/part1"; s/[0-9]+//; print $_,"\n"'


Tollef Fog Heen
Unix _IS_ user friendly... It's just selective about who its friends are.

Reply to: