perl re "translation"

Discussion in 'Perl Misc' started by borges2003xx@yahoo.it, Aug 6, 2005.

  1. Guest

    hi everyone.
    some good fellow can help me to "translate" a python re in perl ?

    r=re.compile(r'(?P<s1>.)(?P<s2>.)(?P<s3>.)(?P<s4>.)(?P<s5>.).*(?P=s5)(?P=s4)(?P=s3)(?P=s2){1,}(?P=s1){1,}')

    it takes a five sequential substring of length 1 and tests if the same
    sequence in reverse order follows.

    thanx everyone
    , Aug 6, 2005
    #1
    1. Advertising

  2. Peter Wyzl Guest

    <> wrote in message
    news:...
    > hi everyone.
    > some good fellow can help me to "translate" a python re in perl ?
    >
    >

    r=re.compile(r'(?P<s1>.)(?P<s2>.)(?P<s3>.)(?P<s4>.)(?P<s5>.).*(?P=s5)(?P=s4)
    (?P=s3)(?P=s2){1,}(?P=s1){1,}')
    >
    > it takes a five sequential substring of length 1 and tests if the same
    > sequence in reverse order follows.


    m/(.)(.)(.)(.)(.)\5\4\3\2\1/



    P
    Peter Wyzl, Aug 6, 2005
    #2
    1. Advertising

  3. Guest

    thank a lot.
    And if i ask that s2 must be of length 3 or more?
    thanks again
    , Aug 6, 2005
    #3
  4. Anno Siegel Guest

    <> wrote in comp.lang.perl.misc:
    > thank a lot.
    > And if i ask that s2 must be of length 3 or more?
    > thanks again


    Is this a quiz or what? What's the next question?

    Anno
    --
    If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers.
    Anno Siegel, Aug 6, 2005
    #4
  5. Guest

    Anno Siegel ha scritto:

    > <> wrote in comp.lang.perl.misc:
    > > thank a lot.
    > > And if i ask that s2 must be of length 3 or more?
    > > thanks again

    >
    > Is this a quiz or what? What's the next question?
    >
    > Anno
    > --
    > If you want to post a followup via groups.google.com, don't use
    > the broken "Reply" link at the bottom of the article. Click on
    > "show options" at the top of the article, then click on the
    > "Reply" at the bottom of the article headers.


    sorry. Really sorry. it is not a quiz. it a way for me to understand
    something of an obscure argument. sorry again but i'm study python but
    re are very slow and so i think of perl implementation
    , Aug 6, 2005
    #5
  6. wrote:
    > some good fellow can help me to "translate" a python re in perl ?
    >
    > r=re.compile(r'(?P<s1>.)(?P<s2>.)(?P<s3>.)(?P<s4>.)(?P<s5>.).*(?P=s5)(?P=s4)(?P=s3)(?P=s2){1,}(?P=s1){1,}')
    >
    > it takes a five sequential substring of length 1 and tests if the same
    > sequence in reverse order follows.


    my $r = qr/(.)(.)(.)(.)(.).*\5\4\3\2{1,}\1{1,}/;



    John
    --
    use Perl;
    program
    fulfillment
    John W. Krahn, Aug 7, 2005
    #6
    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. Stephen Ferg

    Automated Perl to Python translation?

    Stephen Ferg, Sep 4, 2004, in forum: Python
    Replies:
    6
    Views:
    1,223
    John J. Lee
    Sep 8, 2004
  2. TSO
    Replies:
    2
    Views:
    357
    Michele Simionato
    Apr 2, 2005
  3. Jeremy Mclain

    Ruby to Perl translation

    Jeremy Mclain, Nov 23, 2007, in forum: Ruby
    Replies:
    11
    Views:
    187
    Adrian Howard
    Nov 25, 2007
  4. Replies:
    19
    Views:
    193
  5. Replies:
    8
    Views:
    102
    robic0
    Apr 6, 2006
Loading...

Share This Page