<?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=93861&amp;view=findpost&amp;p=707535</guid>
        <pubDate>Fri, 06 May 2005 10:16:46 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=707535</link>
        <description><![CDATA[Tishaishii: В коде выше:<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">.........</div><div class="code_line">next unless $tree-&#62;{tag} eq $tag;</div><div class="code_line">.............</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Вот здесь можно не делать <strong class='tag-b'>next</strong>, а выдавать ошибку о том, что &quot;парность&quot; не соблюдена.<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">die &#39;Парность не соблюдена&#39; unless $tree-&#62;{tag} eq $tag;</div></ol></div></div></div></div>или<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">return -1 unless $tree-&#62;{tag} eq $tag;</div></ol></div></div></div></div> с последующей проверкой на -1.]]></description>
        <author>Tishaishii</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706923</guid>
        <pubDate>Fri, 06 May 2005 04:20:51 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706923</link>
        <description><![CDATA[Song: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=706641'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Mixxx &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T18:02:23+00:00">05.05.05, 18:02</time></span><div class='quote '>Я ж говорю что теги code должны быть парными. Т.е. в данном случае<br>
полная картина должна выглядеть так<br>
[ code ][gg]as[/gg][gg]ansa[/gg][ /code ]<br>
Поэтому функция должна возвращать false </div></div><br>
Парность должна учитываться только в [gg].<br>
В code - нет.<br>
А то что я написал <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=705382'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Song &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T05:15:01+00:00">05.05.05, 05:15</time></span><div class='quote '>Хорошо бы, чтобы ещё проверять и <strong class='tag-b'>[ CODE ]</strong> и [GG] - парные.</div></div><br>
это я не до конца задачу представил себе тогда.<br>
<br>
<strong class='tag-b'>Tishaishii</strong>, спасибо.]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706835</guid>
        <pubDate>Thu, 05 May 2005 22:22:08 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706835</link>
        <description><![CDATA[Tishaishii: <strong class='tag-b'>Song</strong>, помогу, как смогу.<br>
<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">$/=undef;</div><div class="code_line">&nbsp;</div><div class="code_line">sub build_tree {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($tree, $str)=(shift, shift);</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($lpos, $item, $tag, $pos)=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;while($str=~m{\[(/?)(.*?)\]}gc) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$tag=uc ;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(length ) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;next unless $tree-&#62;{tag} eq $tag;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;($tree-&#62;{closed}, $pos)=(1, pos $str);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;push @{$tree-&#62;{cont}},</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;substr $str, $lpos, $pos-$lpos-length $&amp;;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return $pos</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;($item, $pos)=({tag=&#62;$tag, cont=&#62;[]}, pos $str);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;push @{$tree-&#62;{cont}}, substr($`, $lpos, $pos - length $&amp;), $item;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$lpos=$pos+&amp;build_tree($item, substr $str, $pos);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pos($str)=$lpos;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;push @{$tree-&#62;{cont}}, substr $str, $lpos;</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$lpos</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">sub DOM {</div><div class="code_line">&nbsp;&nbsp; &nbsp;my($str, $tree)=(shift || return, shift || {cont=&#62;[]});</div><div class="code_line">&nbsp;&nbsp; &nbsp;&amp;build_tree($tree, $str);</div><div class="code_line">&nbsp;&nbsp; &nbsp;+$tree</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">use Data::Dumper;</div><div class="code_line">print Dumper DOM &#60;DATA&#62;;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">__DATA__</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">fgth gfhgf</div><div class="code_line">[/CDE]</div><div class="code_line">[CDE]</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GG]klldksfklds34[/GG]</div><div class="code_line">&nbsp;&nbsp; &nbsp;ds fds fl;l;dsf</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GG]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;786893ii</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;[CODE]klldksfklds6[/CDE]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;klldksfklds7</div><div class="code_line">&nbsp;&nbsp; &nbsp;[/GG]</div><div class="code_line">[/CDE]</div><div class="code_line">[CDE]</div><div class="code_line">&nbsp;&nbsp; &nbsp;sdf dsgfdhfhfgjh</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GG]klldksfklds34[/GG]</div><div class="code_line">&nbsp;&nbsp; &nbsp;dd fds fl;l;dsf</div><div class="code_line">&nbsp;&nbsp; &nbsp;[GG]klldksfklds6[/GG]fhfgjh</div><div class="code_line">[/CDE]</div><div class="code_line">sdl;f kdsl;f</div></ol></div></div></div></div>]]></description>
        <author>Tishaishii</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706664</guid>
        <pubDate>Thu, 05 May 2005 18:23:13 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706664</link>
        <description><![CDATA[Ho Im: Вообще-то ошметок тега, который неверно либо спарен, либо сам по себе неверен, должен бы по идее возвращаться в своем первоначальном виде. Как и [GG]. То есть, ничего особенного в нем не должно замечаться.]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706641</guid>
        <pubDate>Thu, 05 May 2005 18:02:23 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706641</link>
        <description><![CDATA[Mixxx: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=706591'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Song &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T17:09:33+00:00">05.05.05, 17:09</time></span><div class='quote '>Mixxx<br>
но всё-таки твой пропускает <br>
Цитата (Ho Im @ Вчера, 22:51)	<br>
[gg]as[/gg][gg]ansa[/gg][ /code ]<br>
<br>
?<br>
т.е. он должен возвращать единицу, а он не возвращает.</div></div><br>
Я ж говорю что теги code должны быть парными. Т.е. в данном случае<br>
полная картина должна выглядеть так<br>
[ code ][gg]as[/gg][gg]ansa[/gg][ /code ]<br>
Поэтому функция должна возвращать false :)]]></description>
        <author>Mixxx</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706591</guid>
        <pubDate>Thu, 05 May 2005 17:09:33 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706591</link>
        <description><![CDATA[Song: <strong class='tag-b'>Mixxx</strong><br>
но всё-таки твой пропускает <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=706493'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Ho Im &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T15:51:21+00:00">05.05.05, 15:51</time></span><div class='quote '>[gg]as[/gg][gg]ansa[/gg][ /code ]</div></div><br>
?<br>
т.е. он должен возвращать единицу, а он не возвращает.]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706561</guid>
        <pubDate>Thu, 05 May 2005 16:37:48 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706561</link>
        <description><![CDATA[Mixxx: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=706493'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Ho Im &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T15:51:21+00:00">05.05.05, 15:51</time></span><div class='quote '>Mixxx, [gg]as[/gg][gg]ansa[/gg][ /code ] твоим не пропускается.<br>
Моим пропустился. Значит, не один фиг </div></div><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;[ code ] &nbsp;[GG] [/GG]<span style='color:red'>текст</span>[/ code ]</div></ol></div></div></div></div><br>
А мой пропустит вот это<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">[GG] [/GG]<span style='color:red'>[ code ]</span> [/ code ]</div></ol></div></div></div></div> (Что есть правильно)<br>
 :ph34r:]]></description>
        <author>Mixxx</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706526</guid>
        <pubDate>Thu, 05 May 2005 16:09:41 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706526</link>
        <description><![CDATA[Song: Спасибо, Ho Im]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706493</guid>
        <pubDate>Thu, 05 May 2005 15:51:21 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706493</link>
        <description><![CDATA[Ho Im: <strong class='tag-b'>Mixxx</strong>, это один фиг с моим. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-05T15:54:47+00:00">05.05.05, 15:54</time></span></span><br>
<strong class='tag-b'>Mixxx</strong>, [gg]as[/gg][gg]ansa[/gg][ /code ] твоим не пропускается.<br>
Моим пропустился. Значит, не один фиг :)]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706460</guid>
        <pubDate>Thu, 05 May 2005 15:32:48 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706460</link>
        <description><![CDATA[Mixxx: Советую сделать так:<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">preg_match(&quot;#\[GG\].*?\[/GG\](?!(?:(?!\[CODE.*?\]).)*?\[/CODE\])#i&quot;, $post)</div></ol></div></div></div></div><br>
Будет работать при условии что все теги code парные.<br>
ЗЫ Кстати в языках NET можно заглядывать назад на любую глубину :)]]></description>
        <author>Mixxx</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706434</guid>
        <pubDate>Thu, 05 May 2005 15:06:48 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706434</link>
        <description><![CDATA[Ho Im: А, блин, я слажал -- &quot;смотреть назад&quot; можно только на паттерны фиксированной длины. Подумаем щас, как это обойти. Тебе ничего, кроме ответа да/нет, не надо? <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-05T15:29:08+00:00">05.05.05, 15:29</time></span></span><br>
&quot;#(?&#33;&#092;&#092;[CODE.*?&#092;&#092;])&#092;&#092;[GG&#092;&#092;](.*?)&#092;&#092;[/GG&#092;&#092;](?&#33;&#092;&#092;[/CODE&#092;&#092;])#i&quot; у меня заработал.]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706421</guid>
        <pubDate>Thu, 05 May 2005 14:57:20 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706421</link>
        <description><![CDATA[Song: <strong class='tag-b'>Ho Im</strong><br>
смотри чего php написал:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Warning: Compilation failed: lookbehind assertion is not fixed length at offset 15 in /usr/local/www/votforum/htdocs/TEST/sources/functions.php on line 59</div></div><br>
<br>
59-ая это: <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">preg_match(&quot;#(?&#60;!\[CODE.*?\])\[GG\](.*?)\[/GG\](?!\[/CODE\])#i&quot;, $post)</div></ol></div></div></div></div>]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706257</guid>
        <pubDate>Thu, 05 May 2005 13:13:30 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=706257</link>
        <description><![CDATA[Ho Im: Держи.<br>
<br>
#(?&lt;&#33;&#092;&#092;[CODE.*?&#092;&#092;])&#092;&#092;[GG&#092;&#092;](.*?)&#092;&#092;[/GG&#092;&#092;](?&#33;&#092;&#092;[/CODE&#092;&#092;])#i<br>
<br>
Учти, в первом примере ошибка (копипейст не работал, и я его руками набивал): в конце смотрит не на[/CODE], а [CODE]. Здесь поправил.<br>
<br>
Естессно, учитываются все символы до закрывающей квадратной скобки, даже если ее закавычить. Если это не то, что требуется, то надо еще чуть подумать.]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705942</guid>
        <pubDate>Thu, 05 May 2005 10:46:02 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705942</link>
        <description><![CDATA[Song: <strong class='tag-b'>Ho Im</strong><br>
ещё бы добавить поддержку не только [ CODE ] ... [ /CODE ]<br>
а ещё + [ CODE=произвольные_символы_включая_пробелы ] ... [ /CODE ]<br>
<br>
Внутри них тоже не должно GG срабатывать.]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705767</guid>
        <pubDate>Thu, 05 May 2005 09:09:58 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705767</link>
        <description><![CDATA[Ho Im: А, вдогонку: The F*cking Manual, с которого я это почерпнул -- perldoc perlre, полный референс по регуляркам перла. Там рассказывается о таких замечательных вещах, как zero-width look-{ahead,behind} assertions, которые в данном случае делают то, что нужно. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-05T09:11:05+00:00">05.05.05, 09:11</time></span></span><br>
Ну, там же .*? намеренно в скобки взят, чтобы потом в третий аргумент preg_match его можно было отловить.]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705758</guid>
        <pubDate>Thu, 05 May 2005 09:08:14 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705758</link>
        <description><![CDATA[Song: Спасибо.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=93861&view=findpost&p=705751'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Ho Im &#064; <time class="tag-quote__quoted-time" datetime="2005-05-05T09:05:01+00:00">05.05.05, 09:05</time></span><div class='quote '>Кроме того, должно захватить то, что внутри [GG]...[/GG].</div></div><br>
Это как понять?]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705751</guid>
        <pubDate>Thu, 05 May 2005 09:05:01 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705751</link>
        <description><![CDATA[Ho Im: Дарю, вот&#33;<br>
<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">#(?&#60;!\[CODE\])\[GG\](.*?)\[/GG\](?!\[CODE\])#i</div></ol></div></div></div></div><br>
<br>
Все приведенные тобой test cases прошли. Кроме того, должно захватить то, что внутри [GG]...[/GG].]]></description>
        <author>Ho Im</author>
        <category>RegExp</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705382</guid>
        <pubDate>Thu, 05 May 2005 05:15:01 +0000</pubDate>
        <title>Нужен preg_match</title>
        <link>https://forum.sources.ru/index.php?showtopic=93861&amp;view=findpost&amp;p=705382</link>
        <description><![CDATA[Song: Требуется определить, входит ли строка в другую строку, но вне определённого тега.<br>
<br>
В примере ниже нужно определить входит ли строка [GG] в строки: <br>
<br>
&quot;бла бла бла [GG]бла-бла-бла[/GG]&quot; - входит<br>
<br>
&quot;бла бла бла&quot; - не входит<br>
<br>
&quot;бла [ CODE ]бла бла[ /CODE]&quot; - не входит<br>
<br>
&quot;бла бла бла [ CODE ][GG]бла-бла-бла[/GG][ /CODE ]&quot; - входит, НО:<br>
если искомая строка &quot;[GG]&quot; входит внутри <strong class='tag-b'>парного</strong> тега [ CODE ] тогда preg_match должен возвращать false. Поэтому не входит.<br>
<br>
такая строка &quot;бла бла [GG] бла [ CODE ]бла-бла-бла[ /CODE ]&quot; должна вернуть true т.к. [GG] присутствует и находится вне тега [ CODE ].<br>
<br>
Хорошо бы, чтобы ещё проверять и [ CODE ] и [GG] - парные. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2005-05-05T05:16:07+00:00">05.05.05, 05:16</time></span></span><br>
strpos, как вы понимаете, я использовать не могу.<br>
<br>
Вариант, при котором нужно сначала удалить всё что внутри тега [ CODE ], а потом проверять по strpos не подходит, т.к. тормозной.]]></description>
        <author>Song</author>
        <category>RegExp</category>
      </item>
	
      </channel>
      </rss>
	