function to validate dates using regex in bash -


I have been able to validate two of the following dates to work like this:

  function validate_dates () {# valid date to be yyyy-mm-dd local regex = "^ [[: points]] {4} - [[points:]] {2} - [[points:] "$ Dates" "$$" "$$" "$ {"} "$ dates" ("$ 1" "$ 2") printf "% s \ n" "$ {dates [@]} $ dates" "[__date" [$ __date = ~ $ regex]] || Error_ext "One of the dates is faulty!"  
  validate_dates "2013-05-23" "2014 - # error_exit only function assistant message}  

However when I call the function out with the call Is to exit 07-28 "

I found:

  2013-05-23 2014-07-28 2013-05-23 in dates Is a defective!  

Why does this break out properly formatted dates?

  "^ [[points]] {4} - [[points:] {2} - [[digits]] {2} $ " 

should probably be:

 " ^ [[digits:]] {4} - [[Points:]] {2} - [[Issue:]] {2} $ " 

You have" $ Dates "" $ {dates for __date [ / Code> should probably have missed some colons for __date.

In addition, @]} " "$ Dates" Only the first element of the array is expanded.

<<> Local dates = ("$ 1" "$ 2") If you want more than only 2 parameters or variable parameters,

From

  local dates = ("$ @")  

My version:

  function validate_dates { Local regex = '^ [[: points:]] {4} - [[:: points:]] {2} - [[number:]] {2} $' printf '% s \ n "" $ @ "__ for; [[$ __ = ~ $ regex]] || Error_exit" $ __ is an invalid date. "}}  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -