|Perl Monk, Perl Meditation|
How to include escape sequence characters in regular expressions?by pat_mc (Pilgrim)
|on Feb 12, 2014 at 19:35 UTC||Need Help??|
pat_mc has asked for the
wisdom of the Perl Monks concerning the following question:
I am currently extracting plain text from an InDesign file containing heaps of escape sequence characters. Yes, I am reading the file line by line (as if it were a text file) and am not reading it in in bin mode. This is because - apart frome the escape characters - the input file is quite human-readable.
I would like to write regular expessions for some of those escape sequences to capture specific patterns. My problem is that I don't know how to reference those escape characters in the regexes I am using. I already figured out that the character displaying as 'NUL' in my text editor of the InDesign file is \000. I also found that \x should reference escape characters. However, I have not been able to find a systematic representation for 'EOT', 'DLE' and what have you. Is there something like \xABC I can use to specify the general escape character showing up as ABC in my text editor?
Your help will be much appreciated!
Kind regards -