|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re: regex anchoring issueby kcott (Parson) |
| on Feb 15, 2013 at 05:49 UTC ( #1018845=note: print w/ replies, xml ) | Need Help?? |
|
G'day penguin-attack, Welcome to the monastery. Firstly, your data description seems a little ambiguous: you say "end character" then describe <SOH> (5 chars), ^A (2 chars) and Ctrl-A (1 char). If, by <SOH>, you mean the ASCII character - that is the same character as Ctrl-A (i.e. the character with the ASCII value of 1). Your main problem in your regexp is the use of a character class (i.e. [...]) - see Character Classes and other Special Escapes under perlre - Regular Expressions for details. You also don't need the 'g' modifier in either the match (m/.../) or the split function. The following script does what I think you want (in terms of identifying the line endings). If not, please provide some sample data with expected output to remove the ambiguity I mentioned at the start.
Output:
-- Ken
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||