new to linux/Ubuntu/shell scripting . . .

Tobias Heinemann theine at nordita.dk
Mon Dec 5 22:55:28 UTC 2005


 > If I want to also look for palindromes that are anywhere between 1 and
 > 4 characters in length, what would I do?  I am looking at this : (^|\
 > )([A-Za-z])([A-Za-z])\3\2($|\.|\ )  and I am not seeing how to break
 > it down so I can find palindromes bigger or smaller than 4 character's
 > in length. Could someone explain it to me?  I am very curious.  :)

2 letter: (^|\ )([A-Za-z])\2($|\.|\ )
4 letter: (^|\ )([A-Za-z])([A-Za-z])\3\2($|\.|\ )
8 letter: (^|\ )([A-Za-z])([A-Za-z])([A-Za-z])([A-Za-z])\5\4\3\2($|\.|\ )

You're getting the pattern...

Regards,
Tobi




More information about the ubuntu-users mailing list