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

27458troubles in matching +-*/ using regrex

Expand Messages
  • ssysong
    May 16, 2013
    • 0 Attachment
      i used the string '(+)|(-)|(*)|(\\)|(/)' to match the mathmatic symbols.but it did not work.below is the code.
      ____________________________________________________________________________

      #! /usr/bin/perl -w
      use strict;
      my $op_pattern = '(+)|(-)|(*)|(\\)|(/)';
      my $f = '-1+-2/3\4';
      if($f =~ m/$op_pattern/){
      print "ok","\n";
      }else{
      print "NO","\n";
      }

      [Non-text portions of this message have been removed]
    • Show all 2 messages in this topic