|
Posted by vito on 05/06/06 03:41
>> $matchno = preg_match_all("|.*:(.+)\n$|U", $data, $reg);
>
> In single line mode $ will match the end of the entire text. This mode is
> default. |Um will switch to multi line mode
>
> In single line only \n is needed
> In multi line only $ is needed
For irregularity of files (created by users), i need to first make the file
content into a single line
preg_replace("/\n/", "", $data);
and then perform the matching.
however, i found the replacment fails. maybe that is due to microsoft
newline ^M instead of \n? if so, how to represent ^M in the pattern
matching? furthermore, the newline assumption may be wrong and how can i
know what the characters are there in the white spaces? I cannot use all
space characters since the data also contain spaces.
Thanks a lot.
[Back to original message]
|