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

Re: Silly little regex question

On Sat, 5 Feb 2005 15:17:49 -0800, gcrimp@vcn.bc.ca <gcrimp@vcn.bc.ca> wrote:

> Hmm, his appears not to work as advertised, at least on a woody box, which
> is maybe why you've posted.

> ---------- begin copy ----------
> bash-2.05a$ julyear="009"; echo $julyear
> 009
> bash-2.05a$ echo ${julyear#0}; echo $julyear
> 09
> 009
> bash-2.05a$ echo ${julyear##0}; echo $julyear
> 09
> 009
> bash-2.05a$
> ----------- end copy -----------
> At least, I would have expected the double hash mark to remove all leading
> zeros.

Well, yes and no. If we take seriously the idea that the 'substring' in 


is a regular expression, then what you display would be correct. I
guess my question is:

"What is a regular expression that would match any number of zeros in
succession, and nothing beyond those zeros?"

No no no, my fish's name is Eric, Eric the fish. He's an halibut. I am
not a looney! Why should I be tarred with the epithet looney merely
because I have a pet halibut?

Reply to: