Страница 1 из 1
[php] не могу составить регулярку для цитирования
Добавлено: 2014-01-27 19:11:40
Alex Keda
ну, собсно есть некий текст из почты:
Код: Выделить всё
On 2013-11-11 13:16:47 -0500, Nicholas McKenzie wrote:
> But wouldn't this just disable frequency scaling and the whole
> point of powerd?
No. acpi_throttle (and p4tcc) controls T-state. \"Frequency scaling\"
should be done by changing P-state.
задача сделать его таким
Код: Выделить всё
On 2013-11-11 13:16:47 -0500, Nicholas McKenzie wrote:
[qoute]> But wouldn't this just disable frequency scaling and the whole
> point of powerd?[/quote]
No. acpi_throttle (and p4tcc) controls T-state. \"Frequency scaling\"
should be done by changing P-state.
максимум что я настругал - это как вырезать кусок
Код: Выделить всё
$textPlain = Trim(Preg_Replace('#^>(.*)$#m', '',$textPlain));
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-27 20:08:14
Alex Keda
Код: Выделить всё
$textPlain = Trim(Preg_Replace('/>(.*)\n/i', "[quote]>\\1[/quote]\n",$textPlain));
а вот так оно каждую строчку отдельно цитирует
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-27 20:10:44
Alex Keda
не, ну как высшую степень изврата, можно сделать замену
но чё-то идея такая меня не впечатляет нифига...
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-27 23:40:41
FreeBSP
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-28 17:16:18
FreeBSP
Работаить?
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-30 19:51:26
Alex Keda
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-31 13:08:49
Alex Keda
плохой шаман, аднако...
Код: Выделить всё
bkp0# cat /tmp/a.php
<?php
$textPlain = "
On 2013-11-11 13:16:47 -0500, Nicholas McKenzie wrote:
> But wouldn't this just disable frequency scaling and the whole
> point of powerd?
No. acpi_throttle (and p4tcc) controls T-state. \"Frequency scaling\"
should be done by changing P-state.
> On Mon, Nov 11, 2013 at 1:46 AM, Stefan Esser <se@freebsd.org>
> wrote:
>>
>> Am 10.11.2013 22:46, schrieb Nicholas Stewart McKenzie:
>>> My computer crashes if I enable powerd. I can't get cpu freq
>>> scaling to work with my cpu:(P.S. I sent this to both drivers
>>> and amd64 mailing list...
>
> test line
>
I rewrote acpi_throttle.c at some point to fix the problem but never
committed it because nobody was really interested in testing the
patch. Also, it is really an arcane and archaic feature:
http://software.intel.com/en-us/blogs/2013/10/15/c-states-p-states-where-the-heck-are-those-t-states
";
#$textPlain = Trim(Preg_Replace('/>(.*)\n/i', "[quote]>\\1[/quote]\n",$textPlain));
#$textPlain = preg_replace("/\r/", "\n",$textPlain);
#$textPlain = trim(preg_replace('/[\n]+/m',"\n",$textPlain));
$textPlain = Trim(Preg_Replace('/\n(\>.+(\n\>.+)*)/',"\n[quote]\\1[/quote]",$textPlain));
echo $textPlain;
?>
глянь чё с test line получается:
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-31 13:55:12
FreeBSP
все правильно, все работает ровно по плану, шаман сделал буквально то, что просили
в исходном примере пустых цитируемых строк не было, наверное поэтому такую ситуацию не учел..
Код: Выделить всё
$textPlain = Trim(Preg_Replace('/\n(\>.*(\n\>.*)*)/',"\n[quote]\\1[/quote]",$textPlain));
Re: [php] не могу составить регулярку для цитирования
Добавлено: 2014-01-31 19:09:39
Alex Keda
ага, пасиба