Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] I need to write a Regular Expression

Expand Messages
  • andrewsfulton
    Message 1 of 10 , Nov 29, 2011
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, Shawn H Corey <shawnhcorey@...> wrote:
      >
      > On 11-11-28 04:54 PM, andrewsfulton wrote:
      > > I want to first thank you in advance for being gentle, I am WAY over my
      > > head. I need to write a Regular Expression that will cause "Account #",
      > > Account Number", "Memeber #" and "Member Number" to trigger a message
      > > redirect.
      >
      > /(?:Account|Member) (?:\#|Number)/
      >
      > See `perldoc perlre` for details.
      >
      >
      > --
      > Just my 0.00000002 million dollars worth,
      > Shawn
      >
      > Programming is as much about organization and communication
      > as it is about coding.
      >
      > Never give up your dreams. Give up your goals, plans,
      > strategy, tactics, and anything that's not working but never
      > give up your dreams.
      >
    • Shawn H Corey
      ... You are using a Javascript regex evaluator on a Perl regex. It works in Perl: #!/usr/bin/perl use strict; use warnings; while( ){ if(
      Message 2 of 10 , Nov 29, 2011
      • 0 Attachment
        On 11-11-29 10:53 AM, andrewsfulton wrote:
        > I'm not able to get this expression: /(?:Account|Member) (?:\#|Number)/
        > to work.
        >
        > The validation tool I used is: http://www.sweeting.org/mark/html/revalid.php
        >
        > Am I doing something wrong?

        You are using a Javascript regex evaluator on a Perl regex. It works in
        Perl:

        #!/usr/bin/perl

        use strict;
        use warnings;

        while( <DATA> ){
        if( /(?:Account|Member) (?:\#|Number)/ ){
        print "matched: $_";
        }else{
        print "not: $_";
        }
        }

        __DATA__
        Account Number
        Account #
        Member Number
        Member #
        this is a test



        --
        Just my 0.00000002 million dollars worth,
        Shawn

        Programming is as much about organization and communication
        as it is about coding.

        Never give up your dreams. Give up your goals, plans,
        strategy, tactics, and anything that's not working but never
        give up your dreams.
      • andrewsfulton
        Hello Shawn, That makes sense. It does work on a Perl validator: http://sqa.fyicenter.com/Online_Test_Tools/Test_Regular_Expression_Match_Pattern.php I thought
        Message 3 of 10 , Nov 29, 2011
        • 0 Attachment
          Hello Shawn,

          That makes sense.

          It does work on a Perl validator: http://sqa.fyicenter.com/Online_Test_Tools/Test_Regular_Expression_Match_Pattern.php

          I thought I needed this in Perl, My companies site has a validator as well and it did not catch the phrase. I wonder if it is actually using Java.

          If its not to much to ask, what would the Java expression look like?

          --- In perl-beginner@yahoogroups.com, Shawn H Corey <shawnhcorey@...> wrote:
          >
          > On 11-11-29 10:53 AM, andrewsfulton wrote:
          > > I'm not able to get this expression: /(?:Account|Member) (?:\#|Number)/
          > > to work.
          > >
          > > The validation tool I used is: http://www.sweeting.org/mark/html/revalid.php
          > >
          > > Am I doing something wrong?
          >
          > You are using a Javascript regex evaluator on a Perl regex. It works in
          > Perl:
          >
          > #!/usr/bin/perl
          >
          > use strict;
          > use warnings;
          >
          > while( <DATA> ){
          > if( /(?:Account|Member) (?:\#|Number)/ ){
          > print "matched: $_";
          > }else{
          > print "not: $_";
          > }
          > }
          >
          > __DATA__
          > Account Number
          > Account #
          > Member Number
          > Member #
          > this is a test
          >
          >
          >
          > --
          > Just my 0.00000002 million dollars worth,
          > Shawn
          >
          > Programming is as much about organization and communication
          > as it is about coding.
          >
          > Never give up your dreams. Give up your goals, plans,
          > strategy, tactics, and anything that's not working but never
          > give up your dreams.
          >
        • Shawn H Corey
          ... Don t know; don t use Java. Or do you mean Javascript? -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and
          Message 4 of 10 , Nov 29, 2011
          • 0 Attachment
            On 11-11-29 11:35 AM, andrewsfulton wrote:
            > If its not to much to ask, what would the Java expression look like?

            Don't know; don't use Java. Or do you mean Javascript?


            --
            Just my 0.00000002 million dollars worth,
            Shawn

            Programming is as much about organization and communication
            as it is about coding.

            Never give up your dreams. Give up your goals, plans,
            strategy, tactics, and anything that's not working but never
            give up your dreams.
          • andrewsfulton
            Sorry, i meant Javascript
            Message 5 of 10 , Nov 29, 2011
            • 0 Attachment
              Sorry, i meant Javascript

              --- In perl-beginner@yahoogroups.com, Shawn H Corey <shawnhcorey@...> wrote:
              >
              > On 11-11-29 11:35 AM, andrewsfulton wrote:
              > > If its not to much to ask, what would the Java expression look like?
              >
              > Don't know; don't use Java. Or do you mean Javascript?
              >
              >
              > --
              > Just my 0.00000002 million dollars worth,
              > Shawn
              >
              > Programming is as much about organization and communication
              > as it is about coding.
              >
              > Never give up your dreams. Give up your goals, plans,
              > strategy, tactics, and anything that's not working but never
              > give up your dreams.
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.