[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Регулярное выражение
Страницы: 1, 2, 3, 4
Миша
Игорь_Vasinsky Классный вариант wink.gif

_____________
Принимаю заказы, писать в ЛС
SnowWind
собирает всё, и то где нет Super
SnowWind
отлично так работает
preg_match_all('#' . preg_quote('*** SHOW DOWN ***') . '\s([^\*]+' . preg_quote($nick) . '[^\*]+)\s' . preg_quote('*** SUMMARY ***') . '#Uis', $contents, $result);
print_r($result[1]);

как я и хотел регуляркой, всем спасибо
Игорь_Vasinsky
SnowWind
Цитата
собирает всё, и то где нет Super


хз как ты это всё применяешь.

$nick = 'Super';
$str =
'Seat 1: Joker_SJ
Seat 2: Super
Seat 3: 1e_st@t
Seat 4: Vendo71
Seat 6: leberwurst99
1e_st@t: posts small
Vendo71: posts big
Aaron6565: sits out
*** DEALING HANDS ***
Dealt to Super
leberwurst99: raises
Joker_SJ: calls
Super: raises
1e_st@t: folds
Vendo71: folds
leberwurst99: calls
Joker_SJ: raises
Super: folds
leberwurst99: calls
leberwurst99: discards
Joker_SJ: discards
*** SHOW DOWN ***
leberwurst99: shows
Joker_SJ: shows
leberwurst99 collected
*** SUMMARY ***
Seat 1: Joker_SJ showed
Seat 2: Super (button)
Seat 3: 1e_st@t (small)
Seat 4: Vendo71 (big)
Seat 6: leberwurst99 showed



Seat 2: Super
Seat 3: 1e_st@t
Seat 4: Vendo71
Seat 5: Aaron6565
Seat 6: leberwurst99
Vendo71: posts small
Aaron6565: posts big
*** DEALING HANDS ***
Dealt to Super
leberwurst99: folds
Super: raises
1e_st@t: folds
Vendo71: calls
Aaron6565: folds
leberwurst99 said, ":)"
Vendo71: discards 2 cards
Super: discards
Dealt to Super
Vendo71: checks
Super: checks
*** SHOW DOWN ***
Super: mucks
Vendo71: shows
Vendo71 collected
*** SUMMARY ***
Seat 2: Super mucked
Seat 3: 1e_st@t (button)
Seat 4: Vendo71 (small)
Seat 5: Aaron6565 (big)
Seat 6: leberwurst99 folded
'
;
$nick = preg_quote("Super");
$pattern = preg_quote("SHOW DOWN ***(.*)*** SUMMARY");
$pattern = strtr($pattern, array('\(\.\*\)'=>'(\r\n'. $nick.'.*)'));
echo $pattern;
preg_match("#".$pattern."#Usu", $str, $m);

echo '<pre>' . print_r($m[1], 1) . '</pre>';


Цитата
Super: mucks
Vendo71: shows
Vendo71 collected


_____________
HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, (TSql, BI OLAP, MDX), Mongo, Git, SVN, CodeIgnater, Symfony, Yii 2, JiRA, Redmine, Bitbucket, Composer, Rabbit MQ, Amazon (SQS, S3, Transcribe), Docker
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.