BugTrack/346
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*検索で、文字参照の&を取り去った文字列を検索した場合の出...
-ページ: BugTrack
-投稿者: [[reimy]]
-優先順位: 普通
-状態: 完了
-カテゴリー: 本体バグ
-投稿日: 2003-05-27 (火) 17:06:00
-バージョン:
**メッセージ [#n556e2b0]
文字参照の&を取り去った文字列(copy、tradeなど)を検索した...
tradeを検索して、ページ出力した場合の例
JAVA&<strong class="word0">trade;</strong>
文字参照に含まれる文字列を検索した場合の処理にちょっと工...
----
-「タグまたは実体参照または検索語にマッチさせるパターン」...
diff -u -r1.77 html.php
--- html.php 26 May 2003 13:57:04 -0000 1.77
+++ html.php 27 May 2003 09:42:40 -0000
@@ -83,9 +83,10 @@
{
$s_key = htmlspecialchars($key);
$search_word .= " <strong class=\"word$id\">$s_key</...
- $to = "<strong class=\"word$id\">\$1</strong>";
- $body = preg_replace("/(?:^|(?<=>))([^<]*)/e",
- 'preg_replace("/($pattern)/",$to,\'$1\')',$body);
+ $body = preg_replace_callback(
+ "/(<[^>]*>|&(?:#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);)|...
+ create_function('$arr',
+ 'return $arr[1] ? $arr[1] : "<strong class=\"word'...
$id++;
}
$body = "<div class=\"small\">$_msg_word$search_word<...
-あ…だめだ。実体参照そのものが置換できなくなってる。 -- [...
-これでどうでしょうか。 -- [[ぱんだ]] &new{2003-05-27 (火...
diff -u -r1.77 html.php
--- html.php 26 May 2003 13:57:04 -0000 1.77
+++ html.php 27 May 2003 10:59:09 -0000
@@ -83,9 +83,12 @@
{
$s_key = htmlspecialchars($key);
$search_word .= " <strong class=\"word$id\">$s_key</...
- $to = "<strong class=\"word$id\">\$1</strong>";
- $body = preg_replace("/(?:^|(?<=>))([^<]*)/e",
- 'preg_replace("/($pattern)/",$to,\'$1\')',$body);
+ $pattern = ($s_key{0} == '&') ?
+ "/(<[^>]*>)|($pattern)/" :
+ "/(<[^>]*>|&(?:#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);)|...
+ $body = preg_replace_callback($pattern,
+ create_function('$arr',
+ 'return $arr[1] ? $arr[1] : "<strong class=\"word'...
$id++;
}
$body = "<div class=\"small\">$_msg_word$search_word<...
-うまくいきましたm(__)m -- [[reimy]] &new{2003-05-27 (火)...
//#comment
終了行:
*検索で、文字参照の&を取り去った文字列を検索した場合の出...
-ページ: BugTrack
-投稿者: [[reimy]]
-優先順位: 普通
-状態: 完了
-カテゴリー: 本体バグ
-投稿日: 2003-05-27 (火) 17:06:00
-バージョン:
**メッセージ [#n556e2b0]
文字参照の&を取り去った文字列(copy、tradeなど)を検索した...
tradeを検索して、ページ出力した場合の例
JAVA&<strong class="word0">trade;</strong>
文字参照に含まれる文字列を検索した場合の処理にちょっと工...
----
-「タグまたは実体参照または検索語にマッチさせるパターン」...
diff -u -r1.77 html.php
--- html.php 26 May 2003 13:57:04 -0000 1.77
+++ html.php 27 May 2003 09:42:40 -0000
@@ -83,9 +83,10 @@
{
$s_key = htmlspecialchars($key);
$search_word .= " <strong class=\"word$id\">$s_key</...
- $to = "<strong class=\"word$id\">\$1</strong>";
- $body = preg_replace("/(?:^|(?<=>))([^<]*)/e",
- 'preg_replace("/($pattern)/",$to,\'$1\')',$body);
+ $body = preg_replace_callback(
+ "/(<[^>]*>|&(?:#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);)|...
+ create_function('$arr',
+ 'return $arr[1] ? $arr[1] : "<strong class=\"word'...
$id++;
}
$body = "<div class=\"small\">$_msg_word$search_word<...
-あ…だめだ。実体参照そのものが置換できなくなってる。 -- [...
-これでどうでしょうか。 -- [[ぱんだ]] &new{2003-05-27 (火...
diff -u -r1.77 html.php
--- html.php 26 May 2003 13:57:04 -0000 1.77
+++ html.php 27 May 2003 10:59:09 -0000
@@ -83,9 +83,12 @@
{
$s_key = htmlspecialchars($key);
$search_word .= " <strong class=\"word$id\">$s_key</...
- $to = "<strong class=\"word$id\">\$1</strong>";
- $body = preg_replace("/(?:^|(?<=>))([^<]*)/e",
- 'preg_replace("/($pattern)/",$to,\'$1\')',$body);
+ $pattern = ($s_key{0} == '&') ?
+ "/(<[^>]*>)|($pattern)/" :
+ "/(<[^>]*>|&(?:#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);)|...
+ $body = preg_replace_callback($pattern,
+ create_function('$arr',
+ 'return $arr[1] ? $arr[1] : "<strong class=\"word'...
$id++;
}
$body = "<div class=\"small\">$_msg_word$search_word<...
-うまくいきましたm(__)m -- [[reimy]] &new{2003-05-27 (火)...
//#comment
ページ名: