Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Using regex to match double letters, and only double letters

by vennirajan (Friar)
on Dec 30, 2005 at 08:33 UTC ( #519958=note: print w/replies, xml ) Need Help??


in reply to Using regex to match double letters, and only double letters

Hi,

Using the above solution, you can also try the programs to find out the palindromes. For example,
 print $_ if ( $_ =~ /([[:alpha:]])([[:alpha:]])([[:alpha:]])([[:alpha:]])\3\2\1/i );
This above code matches of the palindrome of length 6.

In the same way you can apply your logic to find out the palindromes.

Hope this will enhance your view in regular expressions.

Regards,
S.Venni Rajan.
"A Flair For Excellence."
                -- BK Systems.

Replies are listed 'Best First'.
Re^2: Using regex to match double letters, and only double letters
by ysth (Canon) on Dec 30, 2005 at 10:29 UTC
    Lots of things you can do with backreferences. Even check for primes:
    perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
    (by Abigail)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2020-10-25 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?