<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64810&amp;view=findpost&amp;p=448648</guid>
        <pubDate>Thu, 02 Sep 2004 13:08:14 +0000</pubDate>
        <title>Опять регулярки</title>
        <link>https://forum.sources.ru/index.php?showtopic=64810&amp;view=findpost&amp;p=448648</link>
        <description><![CDATA[shipbrother: регулярное выражение на ум не приходит, но можно эту проблему решить и другим способом:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;</div><div class="code_line">&#60;?php</div><div class="code_line">&nbsp;&nbsp;$text = &quot;eta peremennaia soderzhit obrabativaemii tekst&quot;;</div><div class="code_line">&nbsp;&nbsp;$maxchars = 30; //max dlina kuska teksta</div><div class="code_line">&nbsp;&nbsp;$lines[0] = &quot;&quot;; //massiv poluchivshihsa strok</div><div class="code_line">&nbsp;&nbsp;$linenumber = 0; //nomer tekushei obrabativaemoi stroki</div><div class="code_line">&nbsp;&nbsp;</div><div class="code_line">&nbsp;&nbsp;$words = explode(&quot; &quot;,$text); &nbsp;//razbivaetm tekst na slova</div><div class="code_line">&nbsp;&nbsp;</div><div class="code_line">&nbsp;&nbsp;foreach ($words as $oneword) { &nbsp;//perebiraem slova</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (strlen($oneword)+strlen($lines[$linenumber]+1)&#60;=$maxchars) { &nbsp;//esli dlina_slova+dlina_stroki+probel&#60;=max_simvolov_vstoke</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$lines[$linenumber] .= &quot; &quot; . $oneword; &nbsp;//dobavliaem slovo k stroke</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;else { &nbsp;//v protivnom sluchae stroka perepolnena</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$linenumber++; &nbsp;//perehodim n asleduiushuiu stroku</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$lines[$linenumber] = $oneword; &nbsp;//dobavliaem slovo</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;};</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;};</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;foreach ($lines as $line) { &nbsp;//vivodim na ekran che poluchilos</div><div class="code_line">&nbsp;&nbsp; &nbsp;echo $line; echo &quot;&#60;br&#62;&quot;;</div><div class="code_line">&nbsp;&nbsp;};</div><div class="code_line">?&#62;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>shipbrother</author>
        <category>HTTP сервера</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64810&amp;view=findpost&amp;p=448366</guid>
        <pubDate>Thu, 02 Sep 2004 09:24:19 +0000</pubDate>
        <title>Опять регулярки</title>
        <link>https://forum.sources.ru/index.php?showtopic=64810&amp;view=findpost&amp;p=448366</link>
        <description><![CDATA[engao: Мне нужно разбить текст по правилу:<br>есть текст, длиной, скажем 100 символов (включая пробелы). Нужно выделить куски, скажем не больше 30 сомволами, но текст резать нужно по последнему проблу, который встретится в этих 30 символах]]></description>
        <author>engao</author>
        <category>HTTP сервера</category>
      </item>
	
      </channel>
      </rss>
	