Re: Regex and Mac vs UNIX line endings

2006-07-21 Thread Peter N Lewis
At 19:25 +0200 20/7/06, kurtz le pirate wrote: hum... is 'end of line' caracter important ? if not, you can do something like that : while (FILE) { chomp; if (/?/) { ... } } yes ? no ? Not really, because if the file is Mac line endings, then that will read the entire file in a

Re: Regex and Mac vs UNIX line endings

2006-07-20 Thread Peter N Lewis
I'm processing a string with embedded newlines. For testing I was storing the text in __DATA__ and slurping it into a string. This works fine. However when I read in a file, I'm having trouble with the line endings. Matching begining/end of logical lines is not working as I expect. Regexes like

Re: Regex and Mac vs UNIX line endings

2006-07-20 Thread Bruce Van Allen
Peter gave some good examples, so I shortened this to supplement his suggestions. I prefer to determine what the end-of-line (eol) character is using something less slippery than \r and \n. In Perl, \n is the native eol for the OS that Perl is executing under, so it could any of the \n, \r, \r\n,

Re: Regex and Mac vs UNIX line endings

2006-07-20 Thread kurtz le pirate
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Andrew Brosnan) wrote: I'm processing a string with embedded newlines. For testing I was storing the text in __DATA__ and slurping it into a string. This works fine. However when I read in a file, I'm having trouble with the line endings.

Solved - Re: Regex and Mac vs UNIX line endings

2006-07-20 Thread Andrew Brosnan
All set with this. Converting the line endings worked fine. Thanks. Andrew On 7/20/06 at 7:25 PM, [EMAIL PROTECTED] (kurtz le pirate) wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Andrew Brosnan) wrote: I'm processing a string with embedded newlines. For testing I was

Regex and Mac vs UNIX line endings

2006-07-19 Thread Andrew Brosnan
I'm processing a string with embedded newlines. For testing I was storing the text in __DATA__ and slurping it into a string. This works fine. However when I read in a file, I'm having trouble with the line endings. Matching begining/end of logical lines is not working as I expect. Regexes like

Re: Regex and Mac vs UNIX line endings

2006-07-19 Thread Robert Hicks
Andrew Brosnan wrote: I'm processing a string with embedded newlines. For testing I was storing the text in __DATA__ and slurping it into a string. This works fine. However when I read in a file, I'm having trouble with the line endings. Matching begining/end of logical lines is not working as I

Re: Regex and Mac vs UNIX line endings

2006-07-19 Thread Andrew Brosnan
On 7/19/06 at 9:51 PM, [EMAIL PROTECTED] (Robert Hicks) wrote: Andrew Brosnan wrote: I'm processing a string with embedded newlines. For testing I was storing the text in __DATA__ and slurping it into a string. This works fine. However when I read in a file, I'm having trouble with the

Re: Regex and Mac vs UNIX line endings

2006-07-19 Thread Doug McNutt
If you want to adjust the line ends in the files have a look at: ftp://ftp.macnauchtan.com/Software/LineEnds/FixEndsFolder.sit 52 kB ftp://ftp.macnauchtan.com/Software/LineEnds/ReadMe_fixends.txt 4 kB Yeah. It's pretty easy in perl too. I have on occasion, read the first few hundred