Hi Andy ,

             thanks for the reply . Yes the purpose is to compare the
timestamps ans yes these are the only two formats .

Thanks,

On Wed, Nov 14, 2018 at 2:48 AM Andy Bach <afb...@gmail.com> wrote:

> Calling upgrade.sql on 05-JUL-18 10.19.42.559000 PM -12
> Calling apply.sql on 17.10.18 12:28:12,447849 +02:
>
> > I created on regex : \d\d\.\d\d\.\d\d\s[012][0-9]:[0-5][0-9]>:[0-5][0-9]
> > this only matches : Calling apply.sql on 17.10.18 12:28:12,447849 +02:
>
> Right as your first string has word chars for the month, not digits. So, a
> straight forward, if only lightly useful one would get both, but as they've
> got entirely different orders, you're not going to be able to do much with
> the result. You'd be better off looking at 2 separate ones, esp. if you
> know one will be prefixed by "upgrade" and the other by "apply" or some
> similar list of words:
> if (     $str =~
> /upgrade.sql\s+on\s+(\d{2}-\w{3}-\d{2})\s+(012][0-9]:[0-5][0-9]:[0-5][0-9])/
> # got $1 eq "date-mon-year" and $2 eq "hr-min-sec"
>      or $str =~
> /apply.sql\s+on\s+(\d{2}\.\d{2}\.\d{2})\s+([012][0-9]:[0-5][0-9]:[0-5][0-9])/
> # got $1 eq "date.month.year" and $2 eq "hr-min-sec"
>     ) {
> # date str's matched
>
> > I need a common regex which matches both the lines ?
> You might want to let us know why? What you're going to do w/ the match.
> Are you validating the strings and, if so, will you reject non-matches?
> Are you looking to break them up into parts, $date, $mon, $year ... ?
> Compare them, maybe to find the difference?  Are these the only 2 formats
> you'll be looking at, that is, maybe some might be 17.10.2018, or 17-10-18?
>
>
>
> On Mon, Nov 12, 2018 at 6:49 AM Asad <asad.hasan2...@gmail.com> wrote:
>
>> Hi all ,
>>
>>            I have two stings from logfile how can we have a common regex
>> so that its parse datetime details for further parsing ;
>>
>> Calling upgrade.sql on 05-JUL-18 10.19.42.559000 PM -12
>> Calling apply.sql on 17.10.18 12:28:12,447849 +02:
>>
>> I created on regex : \d\d\.\d\d\.\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9]
>> this only matches : Calling apply.sql on 17.10.18 12:28:12,447849 +02:
>>
>> I need a common regex which matches both the lines ?
>>
>>
>> Thanks,
>> --
>> Asad Hasan
>> +91 9582111698
>>
>
>
> --
>
> a
>
> Andy Bach,
> afb...@gmail.com
> 608 658-1890 cell
> 608 261-5738 wk
>


-- 
Asad Hasan
+91 9582111698

Reply via email to