อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
Moderator: mindphp, ผู้ดูแลกระดาน
- thatsawan
- PHP VIP Members
- โพสต์: 28508
- ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
- ติดต่อ:
อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง ตอนนี้ ต้องการเขียน ให้ค้นหาคำภาษาไทย ตัวเลข เเละ อักษรภาษาอังกฤษ บลาๆ เเต่ไม่รู้วิธีเขียน Pattern
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41410
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
ตัวอย่าง
https://www.mindphp.com/%E0%B8%9A%E0%B8% ... 9-php.html
https://www.mindphp.com/%E0%B8%9A%E0%B8% ... ssion.html
https://www.mindphp.com/forums/viewtopic.php?f=6&t=29744
https://www.mindphp.com/%E0%B8%9A%E0%B8% ... 9-php.html
https://www.mindphp.com/%E0%B8%9A%E0%B8% ... ssion.html
https://www.mindphp.com/forums/viewtopic.php?f=6&t=29744
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
- tsukasaz
- PHP VIP Members
- โพสต์: 22143
- ลงทะเบียนเมื่อ: 18/04/2012 9:39 am
Re: อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
Simple regex
Regex quick reference
[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\A Start of string
\z End of string
. Any single character
\s Any whitespace character
\S Any non-whitespace character
\d Any digit
\D Any non-digit
\w Any word character (letter, number, underscore)
\W Any non-word character
\b Any word boundary character
(...) Capture everything enclosed
(a|b) a or b
a? Zero or one of a
a* Zero or more of a
a+ One or more of a
a{3} Exactly 3 of a
a{3,} 3 or more of a
a{3,6} Between 3 and 6 of a
ที่มา http://php.net/manual/en/function.preg-match.php
Regex quick reference
[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\A Start of string
\z End of string
. Any single character
\s Any whitespace character
\S Any non-whitespace character
\d Any digit
\D Any non-digit
\w Any word character (letter, number, underscore)
\W Any non-word character
\b Any word boundary character
(...) Capture everything enclosed
(a|b) a or b
a? Zero or one of a
a* Zero or more of a
a+ One or more of a
a{3} Exactly 3 of a
a{3,} 3 or more of a
a{3,6} Between 3 and 6 of a
ที่มา http://php.net/manual/en/function.preg-match.php
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
Re: อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
ปัญหาโลกแตกมาฟังก๋ชั่นนี้ตอนอัพเกรดเวอร์ชั่นแทนจะรื้อเขียนใหม่เลย
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ ปัญหาเช็ค image จาก preg ไมไ่ด้(บางภาพ)
โดย offing » 23/04/2015 5:41 pm » ใน Programming - PHP - 5 ตอบกลับ
- 1143 แสดง
-
โพสต์ล่าสุด โดย mindphp
27/04/2015 4:38 pm
-
-
-
โพสต์ใหม่ การเขียนโปรแกรม แบบ MVC Pattern ของโปรแกรมเมอร์
โดย Before Dong » 12/09/2017 10:31 am » ใน พูดคุยเรื่องทั่วไป จับฉ่าย - 0 ตอบกลับ
- 791 แสดง
-
โพสต์ล่าสุด โดย Before Dong
12/09/2017 10:31 am
-
-
-
โพสต์ใหม่ ต้องการจะค้นหาไฟล์ใน folder ตาม pattern เขียนยังไงได้บ้างค่ะ
โดย thatsawan » 13/05/2019 5:36 pm » ใน Programming - PHP - 2 ตอบกลับ
- 1004 แสดง
-
โพสต์ล่าสุด โดย thatsawan
14/05/2019 3:52 pm
-
-
-
โพสต์ใหม่ replace หลายจุด และหลาย pattern พร้อมกันจบในการรันคำสั่งครั้งเดียว
โดย jataz2 » 16/10/2019 3:17 pm » ใน Programming - C/C++ & java & Python - 0 ตอบกลับ
- 923 แสดง
-
โพสต์ล่าสุด โดย jataz2
16/10/2019 3:17 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 99