You are here: Re: regular expression inquiry « PHP Programming Language « IT news, forums, messages
Re: regular expression inquiry

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация