in reply to Regex to capture every readable character except COMMA
Output:#!/usr/bin/perl -w use warnings; use strict; my $var = "abc,d"; if($var =~ /,/) { print "not matches \n"; } elsif($var =~ /(.*)/) { print "matches \n Captured: $1\n"; } $var = "abcd"; if($var =~ /,/) { print "not matches \n"; } elsif($var =~ /(.*)/) { print "matches \n Captured: $1\n"; } exit 0;
not matches matches Captured: abcd
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to capture every readable character except COMMA
by AnomalousMonk (Archbishop) on Jan 09, 2014 at 19:02 UTC |