codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
my $lines = <<EOF; " AString " // leading and trailing spaces together allowed "AString " // trailing spaces allowed " AString" // leading spaces allowed "newString03" // numeric chars allowed "!stringBIG?" // non-alphanumeric chars allowed "R" // Single UC is a match "A String" // not a match because it contains an embedded space "a_string" // not a match because there are no UC chars EOF for my $line (split /\n/, $lines) { $line =~ s://.*$::; print $line; if ($line =~ /"(?![^"\s]+\s+[^"\s]+")[^"]*[A-Z][^"]*"/) { print "matches\n"; } else { print "does not match.\n"; } }
Private
[
?
]
Run code
Submit