summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-06 22:04:31 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-06 22:04:31 +0200
commit30e977cc418e8e71a0e9da239573fae46990a45a (patch)
tree8d4954905ef57818efadd035b8d8ed71613ae1cb
parent5d059fa82855dc2896ecd670f61722a47aaa6550 (diff)
downloadbin-30e977cc418e8e71a0e9da239573fae46990a45a.tar.gz
bin-30e977cc418e8e71a0e9da239573fae46990a45a.tar.xz
add regcheck.pl
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rwxr-xr-xregcheck.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/regcheck.pl b/regcheck.pl
new file mode 100755
index 0000000..c5a7023
--- /dev/null
+++ b/regcheck.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use File::Basename;
+
+if (@ARGV != 2) {
+ print "usage: ", basename($0), " <regexp> <string>\n";
+ exit 2;
+}
+
+my $string = $ARGV[1];
+my $pattern = $ARGV[0];
+
+if ($string =~ /$pattern/) {
+ print "\e[0;32mmatches:\e[0m $&\n";
+ exit 0;
+} else {
+ print "\e[0;31mno match\e[0m\n";
+ exit 1;
+}