[過去ログ]
正規表現道場@2ch Part3 s/煽り|荒らし/あぼーん/g (989レス)
正規表現道場@2ch Part3 s/煽り|荒らし/あぼーん/g http://tamae.5ch.net/test/read.cgi/php/1069245758/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
533: nobodyさん [sage] 04/07/22 14:35 ID:??? ああ、なるほど 広告を非表示にしたいわけか http://tamae.5ch.net/test/read.cgi/php/1069245758/533
534: nobodyさん [] 04/07/24 14:34 ID:wErUOaoh 文中に自動リンクをしたいのですが、Googleの検索結果のようなめちゃくちゃ長いURLを短くして表示することは出来ますか? $str = "googleの結果<br>ttp://www.google.co.jp/search?hl=ja&ie=UTF-8&q=ereg_replace&btnG=Google+%E6%A4%9C%E7%B4%A2&lr=lang_ja<br>..." $str = ereg_replace("http://[^<>[:space:]]+[[:alnum:]/]","<a href=\\0>\\0</a>", $str); これをこのように出力したい。 <a href=ttp://www.google.co.jp/search?hl=ja&ie=UTF-8&q=ereg_replace&btnG=Google+%E6%A4%9C%E7%B4%A2&lr=lang_ja>ttp://www.google.co.jp/search?hl=ja&ie=...</a> http://tamae.5ch.net/test/read.cgi/php/1069245758/534
535: nobodyさん [sage] 04/07/24 14:51 ID:??? >>534 $strからgoogleの結果<br>と<br>を取り除いてから <a href=$str>ttp://www.google.co.jp/search?hl=ja&ie=...</a> でいいだろ。 http://tamae.5ch.net/test/read.cgi/php/1069245758/535
536: nobodyさん [] 04/07/24 15:12 ID:wErUOaoh 早速のレスありがとうございます。 $str はいわゆる掲示板の書き込みのコメント部分です。 で、それを自動リンクしたいんですが、コメント中に長いURLを張るとテーブルが壊れます。 実際のリンクは超略しないで、表示部分だけ短く省略したいんです。 http://tamae.5ch.net/test/read.cgi/php/1069245758/536
537: nobodyさん [sage] 04/07/24 16:35 ID:??? $str = ereg_replace("http://[^<>[:space:]]+[[:alnum:]/]","<a href=\\0>リンク</a>", $str); http://tamae.5ch.net/test/read.cgi/php/1069245758/537
538: nobodyさん [] 04/07/24 17:11 ID:wErUOaoh ttp://ns1.php.gr.jp/pipermail/php-users/2002-April/007102.html ヘボイらしいのですが、ここを参考にして何とかなりました。 お騒がせしました。 http://tamae.5ch.net/test/read.cgi/php/1069245758/538
539: nobodyさん [] 04/07/24 23:27 ID:b6ZQFx0g <table> の中の、入れ子構造になっている セルを抽出する方法を教えてください <table> <tr> <th> TH1 </th> <td> TD1 </td> </tr> </table> <table> <tr> <th> <table> <tr> <th> TH2 </th> <td> TD2 </td> </tr> </table> TH3 </th> <td> TD3 </td> </tr> </table> 欲しいものは、 TH1 と TD1 TH2 と TD2 <table> <tr> <th> TH2 </th> <td> TD2 </td> </tr> </table> TH3 と TD3 です 環境は php4.3 です http://tamae.5ch.net/test/read.cgi/php/1069245758/539
540: nobodyさん [sage] 04/07/25 01:22 ID:??? 入れ子になっている構造は正規文法で表せません http://tamae.5ch.net/test/read.cgi/php/1069245758/540
541: nobodyさん [sage] 04/07/25 04:31 ID:??? xslt とかの方が向いてそうだな http://tamae.5ch.net/test/read.cgi/php/1069245758/541
542: nobodyさん [sage] 04/07/25 06:16 ID:??? >>539 http://www.din.or.jp/~ohzaki/regex.htm#GetNestedParen http://tamae.5ch.net/test/read.cgi/php/1069245758/542
543: nobodyさん [] 04/07/26 14:57 ID:nr00S6gf 「test.html#aiueo」「abc.jsp#123」という文字列があって #の前の文字列を取得したい場合はどのような正規表現にすれば良いのでしょうか○| ̄|_ http://tamae.5ch.net/test/read.cgi/php/1069245758/543
544: nobodyさん [sage] 04/07/26 15:12 ID:??? >>543 ^([^#]*) ^(.*?)# http://tamae.5ch.net/test/read.cgi/php/1069245758/544
545: nobodyさん [sage] 04/07/26 15:18 ID:??? >>544 ありがとうございます○| ̄|_ うー、もっと勉強しなければ。(*)#とかしてますた。 http://tamae.5ch.net/test/read.cgi/php/1069245758/545
546: nobodyさん [sage] 04/07/28 01:04 ID:??? xmlで ------------------------ <qqq> <abc>123</abc> <rrr>aiueo</rrr> <abc>456</abc> </qqq> ------------------------ というような構造のとき、 <qqq>の中の文字列を取り出し それに対して /<abc>([^&]+)<\/abc>/ でマッチング処理を行うと、 ------------------------ 123</abc> <rrr>aiueo</rrr> <abc>456 ------------------------ という結果になってしまいます。 一つ目の<abc>123</abc>に正しく反応させたいのですが どのようにすればよいのでしょうか。 よろしくお願いいたします。 ※マッチング処理の際の /<abc>([^&]+)<\/abc>/ のabc部分は可変です。 http://tamae.5ch.net/test/read.cgi/php/1069245758/546
547: nobodyさん [sage] 04/07/28 01:24 ID:??? >>546 基本だと思うけれども最小マッチ /<abc>([^&]+?)<\/abc>/ http://tamae.5ch.net/test/read.cgi/php/1069245758/547
548: nobodyさん [sage] 04/07/28 01:37 ID:??? >>547 546です。すみません、本当に助かりました。 ありがとうございます。 (とほほさんのHP見ながらやっていたんですが、それ以外にも対応していたり するんですね。今後は気をつけます。) http://tamae.5ch.net/test/read.cgi/php/1069245758/548
549: nobodyさん [sage] 04/07/28 01:37 ID:??? だからとほほはアテにならない。 http://tamae.5ch.net/test/read.cgi/php/1069245758/549
550: nobodyさん [sage] 04/07/28 02:00 ID:??? XMLなら正規表現使わずともDOMやSAXで抽出できるんじゃないの http://tamae.5ch.net/test/read.cgi/php/1069245758/550
551: nobodyさん [sage] 04/07/28 02:36 ID:??? >>550 むしろそっちの方が正攻法な気も。 http://tamae.5ch.net/test/read.cgi/php/1069245758/551
552: nobodyさん [sage] 04/07/29 00:49 ID:??? >>547 546ではないけど質問です。 /<abc>([^&]+?)<\/abc>/ だと<abc>123</abc>にはマッチするけど、<abc><123></abc>マッチしませんでした。 こういう文字コードを使われてるものもマッチさせる方法はあるんですか? http://tamae.5ch.net/test/read.cgi/php/1069245758/552
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 437 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.013s