ช่วยเขียน regular expression ด้วยครับ

เริ่มโดย ddtoe, 02 พฤษภาคม 2013, 16:42:05

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

ddtoe

<a style="background-image: url(h**p://www.logitech.com/img10010.jpg);" id="pictop"</a>

จาก Code ข้างบน ผมจะเขียน regular expression  อย่างไรครับผมต้องการข้อมูลจากในวงเล็บ h**p://www.logitech.com/img10010.jpg และต้องการให้ดึงจาก id="pictop" เท่านั้นครับ
ผมเขียนได้แค่ดึงข้อมูลในวงเล็บครับ /<a style=\"background-image: url[(]+([^"\')\\s]+)/ เขียนได้เท่านี้ครับช่วยแนะนำด้วยครับ ??



thaisew

แบบนี้ได้ไหมอ่า แล้ว แทนที่เอา

http(.*)pictop\"<\/a>

Putter™

#2
<?php
$data '<a style="background-image: url(h**p://www.logitech.com/img10010.jpg);" id="pictop"</a>';
preg_match_all('/\((.+?)\);" id="pictop"/',$data,$match);
print_r($match[1]);
?>


result

Array
(
    [0] => h**p://www.logitech.com/img10010.jpg
)



แบบนี้ป่าวหว่า
[direct=https://hostings.ruk-com.in.th]Ruk-Com Hosting (IAAS)[/direct]
[direct=https://ruk-com.cloud]Ruk-Com Cloud (PAAS)[/direct]
รีวิวโฮสติ่ง Ruk-Com  จากสมาชิก THAISEO

ไม่พอใจยินดีคืนเงินเต็มจำนวนทุกบริการ

xvlnw.com

ลองศึกษา http://simplehtmldom.sourceforge.net/ ดูครับ
ไม่ต้องเครียดเรื่อง Regular Exception ครับ
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw

ddtoe

#4
อ้างถึงจาก: Putter™ ใน 02 พฤษภาคม 2013, 17:24:56
<?php
$data '<a style="background-image: url(h**p://www.logitech.com/img10010.jpg);" id="pictop"</a>';
preg_match_all('/\((.+?)\);" id="pictop"/',$data,$match);
print_r($match[1]);
?>


result

Array
(
    [0] => h**p://www.logitech.com/img10010.jpg
)



แบบนี้ป่าวหว่า

แบบนี้ได้ครับ ขอบคุณมากครับ  :wanwan017:  เขียนสั่นกว่าของผมเอยาะเลยเลย