Fwd: Date format search in the file



2008/11/22 sftriman <dalyea@xxxxxxxxx>:
On Nov 22, 6:16 am, paik...@xxxxxxxxxxxxxx (Dermot) wrote:
2008/11/22 Sureshkumar M (HCL Financial Services) <Sureshkuma...@xxxxxx>:

I could be wrong but I don't think \w will not match a hypen "-" so
the test will fail.
This works for me:

if ($_=~/\d{1,2}-(\d{2}|\w{3})-\d+/)

HTH,
Dp.

Opps, yes John that correct. I didn't scroll down to the bit where it said

Output should be.


Thanks for the reply. I added strict and warning, and thankfully,
there were no messages.

The while loop on the file handle makes sense - I should do that.

What are you referring to in the if part? I see I have an unescaped
hyphen which
I will make \- in the regexp compare.

Who escaped a hypen? There is no need to escape a hypen. You escape
meta-characters and a hypen isn't.

But what is the compare you are
writing?

My Regex was incorrect, as John pointed out. I was looking for

1 or 2 digit, a hypen, a 2 digit number of 3 character string, a hypen
and any number of word characters.

You only want two digit day values and a 2-4 digit year value so
/\d{2}-(\d{2}|\w{3}-\d{2,4}/ would be the regex I would use.

Have a look at perldoc perlretut


Also, I ran the script many times just now - it runs so fast, I can't
see why it's
causing the CPU surge:

<Q>$ time proc-js*pl
0.29s real 0.24s user 0.04s system
<Q>$ time proc-js*pl
0.33s real 0.28s user 0.03s system
<Q>$ time proc-js*pl
0.39s real 0.34s user 0.05s system

Can't help with that. :-/

Dp.
.



Relevant Pages

  • Re: Voters registration
    ... few voters with different last names living at the same address. ... labels for the same address. ... then a 5 digit zip? ... I also need to combine first names (ie Joe, Mary and John live ...
    (microsoft.public.access.queries)
  • Re: Voters registration
    ... then a 5 digit zip? ... labels. ... I also need to combine first names (ie Joe, Mary and John live ... the same house - the address label should read - Joe, ...
    (microsoft.public.access.queries)
  • Re: Can foreground and background colors be queried?
    ... |> Gerard46 wrote: ... |>| John Small wrote: ... Is there an ASCII escape sequnce number which ... I haven't gotten Regina or R4 to do that with ...
    (comp.lang.rexx)
  • Re: Query for Left(String,5) - Access 2007
    ... I think that is more what the OP wants, John, except boston.boston is the 5 ... digit field and Name.zip is the 9 digit version as I read the post. ... Note that this query cannot use the query design view, ... FROM ((boston INNER JOIN Name ON boston.Boston = Name.ZIP) INNER JOIN ...
    (microsoft.public.access.queries)
  • Re: need help with query
    ... think John V. called it right on this. ... are only one digit that are causing the invalid call. ... Don't need a make table query! ...
    (microsoft.public.access.gettingstarted)