zsh-users
 help / color / mirror / code / Atom feed
* Matching numbers
@ 2003-10-05 12:50 DervishD
  2003-10-05 16:01 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: DervishD @ 2003-10-05 12:50 UTC (permalink / raw)
  To: Zsh Users

    Hi all :))

    Is there a way of matching numeric ranges taking into account
leading zeroes? I want to match, for example, a day of the month,
from 00 to 31, but with leading zeroes. Cannot use <00-31> because it
will match just a '1', too, and something like <0-3><0-9> will match
39, too.

     The last one is not a big problem, because I don't mind the
exact number, in fact I must just match a 'look-like'. What I mean is
that I can safely match ????-??-??, for example, and the function
will work (I just want to know if the file has a date-code in its
first line, for seeing how much time has passed since a package was
last updated), but I would like to learn a bit more about pattern
matching. I know that with zsh I can make this match more precise.

    Thanks a lot in advance :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Matching numbers
  2003-10-05 12:50 Matching numbers DervishD
@ 2003-10-05 16:01 ` Bart Schaefer
  2003-10-05 16:18   ` DervishD
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2003-10-05 16:01 UTC (permalink / raw)
  To: Zsh Users

On Oct 5,  2:50pm, DervishD wrote:
}
}     Is there a way of matching numeric ranges taking into account
} leading zeroes?

Not directly, no.  But this is where alternation syntax is useful:

	(0<0-9>|<10-31>)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Matching numbers
  2003-10-05 16:01 ` Bart Schaefer
@ 2003-10-05 16:18   ` DervishD
  0 siblings, 0 replies; 3+ messages in thread
From: DervishD @ 2003-10-05 16:18 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

    Hi Bart :)

 * Bart Schaefer <schaefer@brasslantern.com> dixit:
> }     Is there a way of matching numeric ranges taking into account
> } leading zeroes?
> Not directly, no.  But this is where alternation syntax is useful:
> 	(0<0-9>|<10-31>)

    Good idea. Thanks :) I don't use alternations because I'm not
familiar with them outside case statements, so I never remember them
when necessary O:)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-05 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-05 12:50 Matching numbers DervishD
2003-10-05 16:01 ` Bart Schaefer
2003-10-05 16:18   ` DervishD

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).