in reply to Please help me to write a regex for this input?

The script should consider newline characters

Whatever script you are talking about - see the s modifier (single line mode) for m// and s/// in perlre.
See perlrun fpr the implicit looping switches -n and -p, and the input separator modifying switch -0 with its special value 0 (e.g. -00) for reading files in paragraph mode.

For further advice, provide comprehensive source code.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'