Salesforce : APEX regular expressions

Regular expressions (REGX), is a very powerful utility in String data processing ( generally provided by all programming languages). Using regular expression, you can perform complex string operations in simple and short way ( may be one or two lines of code, for which if you write your own code, may lead to 100-200 lines of code). Basic regular expression, you may have used with your dos or Unix file search, *.txt, *.exe files.

APEX programming also supports for REGX, let?s take a scenario below.

Scenario : Space Scientists have received a message from aliens. They tried hard to decrypt this message, finally successful derived algorithm for that