backreferences to two sets of slashes

Discussion in 'Perl Misc' started by Eric smith, Nov 6, 2011.

  1. Eric smith

    Eric smith Guest

    if ( $foo =~ /(\d\d)-(\d\d)-\d\d\d\d/ and $bar =~ /(\d?\d):(\d\d):(\d\d)/ )
    {

    # How do I match here the the two fields of $foo ?
    # Or is it not possible in a single construction?
    # $bar of course gives its hours minutes and seconds in $1, $2 and $3
    }

    Thanks

    --
    Eric Smith
     
    Eric smith, Nov 6, 2011
    #1
    1. Advertising

  2. On Sun, 6 Nov 2011, Eric smith wrote:

    > if ( $foo =~ /(\d\d)-(\d\d)-\d\d\d\d/ and $bar =~ /(\d?\d):(\d\d):(\d\d)/ )
    > {
    >
    > # How do I match here the the two fields of $foo ?
    > # Or is it not possible in a single construction?


    What about

    if ("$foo===$bar" =~
    /(\d\d)-(\d\d)-\d\d\d\d/.*===.*(\d?\d):(\d\d):(\d\d)/)

    --
    Helmut Richter
     
    Helmut Richter, Nov 6, 2011
    #2
    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. qazmlp
    Replies:
    5
    Views:
    699
    Michael Dunn
    Apr 7, 2004
  2. Peter Horlock
    Replies:
    2
    Views:
    308
  3. Dan Wilkin
    Replies:
    1
    Views:
    267
    robic0
    Jul 17, 2006
  4. java
    Replies:
    7
    Views:
    281
  5. Eric Smith

    Backreferencing through two sets of slashes

    Eric Smith, Nov 6, 2011, in forum: Perl Misc
    Replies:
    1
    Views:
    215
    C.DeRykus
    Nov 8, 2011
Loading...

Share This Page