filename regex?

Discussion in 'Perl Misc' started by Jules, Jan 30, 2004.

  1. Jules

    Jules Guest

    Am trying to modify a regular expression in a perl script at:
    http://groups.google.com/groups?selm=bb5bn4$2ljv$

    > the regex in this line:
    > if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
    > has to match the file name of your mail files. I use mail files named like
    > so:
    >
    > 1049831444.88767.thunderbird.etv.net,S=2514
    >
    > timestamp.procId.domainname,S=filesize


    My mail files are named slightly different, for example:
    1075497569.85543_0.host.domain.net

    timestamp.procId_0.domainname

    Can anyone help modify the regex to match my filename?
     
    Jules, Jan 30, 2004
    #1
    1. Advertising

  2. In article <>,
    Jules <> wrote:
    |Am trying to modify a regular expression in a perl script at:
    |http://groups.google.com/groups?selm=bb5bn4$2ljv$

    |> the regex in this line:
    |> if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
    |> has to match the file name of your mail files. I use mail files named like
    |> so:

    |> 1049831444.88767.thunderbird.etv.net,S=2514

    |My mail files are named slightly different, for example:
    |1075497569.85543_0.host.domain.net

    |Can anyone help modify the regex to match my filename?

    m|^(\d+)\.\d+_0\.|

    would be the closest equivilent.
    --
    "Meme" is self-referential; memes exist if and only if the "meme" meme
    exists. "Meme" is thus logically a meta-meme; but until the existance
    of meta-memes is more widely recognized, "meta-meme" is not a meme.
    -- A Child's Garden Of Memes
     
    Walter Roberson, Jan 30, 2004
    #2
    1. Advertising

  3. Jules

    MPBroida Guest

    Jules wrote:
    >
    > Am trying to modify a regular expression in a perl script at:
    > http://groups.google.com/groups?selm=bb5bn4$2ljv$
    >
    > > the regex in this line:
    > > if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) {
    > > has to match the file name of your mail files. I use mail files named like
    > > so:
    > >
    > > 1049831444.88767.thunderbird.etv.net,S=2514
    > >
    > > timestamp.procId.domainname,S=filesize

    >
    > My mail files are named slightly different, for example:
    > 1075497569.85543_0.host.domain.net
    >
    > timestamp.procId_0.domainname
    >
    > Can anyone help modify the regex to match my filename?


    m|^(\d+)\.\d+_0\.|

    might work. All I did was add the _0 after the
    last set of digits. If that's not always a ZERO,
    change _0 to _\d or use \d+ if it might be more
    than one digit after the underscore. NOTE: This
    REQUIRES the underscore to be present!

    Mike
     
    MPBroida, Jan 30, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    Extract filename from a filename typed by user

    =?Utf-8?B?Sm9l?=, Aug 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,043
    Travis Murray
    Aug 24, 2004
  2. Replies:
    1
    Views:
    1,531
    Roland de Ruiter
    Jun 15, 2006
  3. Ed
    Replies:
    10
    Views:
    46,218
    alok000707
    Jul 13, 2010
  4. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    771
    Jonathan N. Little
    May 30, 2008
  5. Bergamot
    Replies:
    0
    Views:
    462
    Bergamot
    May 30, 2008
Loading...

Share This Page