Bước tới nội dung

Khác biệt giữa bản sửa đổi của “Biểu thức chính quy”

Bách khoa toàn thư mở Wikipedia
Nội dung được xóa Nội dung được thêm vào
Luckas-bot (thảo luận | đóng góp)
n r2.7.1) (Bot: Thêm wa:Erîlêye ratourneure
Dammio (thảo luận | đóng góp)
Không có tóm lược sửa đổi
Dòng 1: Dòng 1:
{{Sơ khai}}
'''Biểu thức chính quy''' ([[tiếng Anh]]: ''regular expression'', viết tắt là ''regexp'', ''regex'' hay ''regxp'') là một [[chuỗi (khoa học máy tính)|chuỗi]] miêu tả một bộ các chuỗi khác, theo những quy tắc cú pháp nhất định. Biểu thức chính quy thường được dùng trong các [[trình biên tập văn bản]] và các tiện ích tìm kiếm và xử lý văn bản dựa trên các mẫu được quy định. Nhiều [[ngôn ngữ lập trình]] cũng hỗ trợ biểu thức chính quy trong việc xử lý chuỗi, chẳng hạn như [[Perl]] có bộ máy mạnh mẽ để xử lý biểu thức chính quy được xây dựng trực tiếp trong cú pháp của chúng. Bộ các trình tiện ích (gồm trình biên tập [[sed]] và trình lọc [[grep]]) đi kèm các bản phân phối [[Unix]] có vai trò đầu tiên trong việc phổ biến khái niệm biểu thức chính quy.
'''Biểu thức chính quy''' ([[tiếng Anh]]: ''regular expression'', viết tắt là ''regexp'', ''regex'' hay ''regxp'') là một [[chuỗi (khoa học máy tính)|chuỗi]] miêu tả một bộ các chuỗi khác, theo những quy tắc cú pháp nhất định. Biểu thức chính quy thường được dùng trong các [[trình biên tập văn bản]] và các tiện ích tìm kiếm và xử lý văn bản dựa trên các mẫu được quy định. Nhiều [[ngôn ngữ lập trình]] cũng hỗ trợ biểu thức chính quy trong việc xử lý chuỗi, chẳng hạn như [[Perl]] có bộ máy mạnh mẽ để xử lý biểu thức chính quy được xây dựng trực tiếp trong cú pháp của chúng. Bộ các trình tiện ích (gồm trình biên tập [[sed]] và trình lọc [[grep]]) đi kèm các bản phân phối [[Unix]] có vai trò đầu tiên trong việc phổ biến khái niệm biểu thức chính quy.


==Tham khảo==
{{Refbegin}}
*{{Cite book
| last = Aho
| first = Alfred V.
| author-link =Alfred Aho
| year = 1990
| contribution = Algorithms for finding patterns in strings
| editor-last = van Leeuwen
| editor-first = Jan | editor-link = Jan van Leeuwen
| title = Handbook of Theoretical Computer Science, volume A: Algorithms and Complexity
| publisher = The MIT Press
| pages = 255–300
| ref = harv
| postscript = <!--None-->
}}
*{{Cite document
| publisher = The Open Group
| url = http://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html
| contribution = Regular Expressions
| title = The Single UNIX ® Specification, Version 2
| date = 1997
| ref = harv
| postscript = <!--None-->
}}
*{{Cite document
| publisher = The Open Group
| url = http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html
| contribution = Chapter 9: Regular Expressions
| title = The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
| date = 2004
| ref = harv
| postscript = <!--None-->
}}
*{{cite web
| url = http://swtch.com/~rsc/regexp/regexp1.html
| title=Regular Expression Matching Can Be Simple and Fast
| last = Cox
| first = Russ
| year = 2007
| ref = harv
| postscript = <!--None-->}}
*{{cite book
| first = Ben
| last = Forta
| authorlink = Ben Forta
| year =2004
| title = Sams Teach Yourself Regular Expressions in 10 Minutes
| publisher = Sams
| isbn = 0-672-32566-7
}}
*{{cite book
| first = Jeffrey
| last = Friedl
| authorlink = Jeffrey Friedl
| year =2002
| title = Mastering Regular Expressions
| url = http://regex.info/
| publisher = [[O'Reilly Media|O'Reilly]]
| isbn = 0-596-00289-0
}}
*{{cite conference
| last1 = Gelade | first1 = Wouter
| last2 = Neven | first2 = Frank
| title = Succinctness of the Complement and Intersection of Regular Expressions
| pages = 325–336
| booktitle = Proceedings of the 25th International Symposium on Theoretical Aspects of Computer Science (STACS 2008)
| url = http://drops.dagstuhl.de/opus/volltexte/2008/1354
| year = 2008
| ref = harv
| postscript = <!--None-->}}
*{{cite conference
| last1 = Gruber | first1 = Hermann
| last2 = Holzer | first2 = Markus
| title = Finite Automata, Digraph Connectivity, and Regular Expression Size
| pages = 39–50
| booktitle = Proceedings of the 35th International Colloquium on Automata, Languages and Programming (ICALP 2008)
| url = http://www.hermann-gruber.com/data/icalp08.pdf
| year = 2008
| doi = 10.1007/978-3-540-70583-3_4
| volume = 5126
| ref = harv
| postscript = <!--None-->
}}
*{{cite book
| first = Mehran
| last = Habibi
| authorlink = Mehran Habibi
| year =2004
| title = Real World Regular Expressions with Java 1.4
| publisher = Springer
| isbn = 1-59059-107-0
}}
*{{cite book
| last1 = Hopcroft
| first1 = John E.
| last2 = Motwani
| first2 = Rajeev
| last3 = Ullman
| first3 = Jeffrey D.
| title = Introduction to Automata Theory, Languages, and Computation
| publisher = Addison-Wesley
| year = 2000
| edition = 2nd
| ref = harv
}}
*{{Cite book
|last = Kleene
|first = Stephen C.
|contribution = Representation of Events in Nerve Nets and Finite Automata
|title = Automata Studies
|editor1-last = Shannon
|editor1-first = Claude E.
|editor2-last = McCarthy
|editor2-first = John
|publisher = Princeton University Press
|year = 1956
|pages = 3–42
|ref = harv
|postscript = <!--None-->
}}
*{{Cite journal
|last = Kozen
|first = Dexter
|contribution = A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events
|title = Proceedings of the 6th Annual IEEE Symposium on Logic in Computer Science (LICS 1991)
|pages = 214–225
|year = 1991
|ref = harv
|postscript = <!--None-->
}}
*{{cite web | url=http://www.laurikari.net/tre/ | title = TRE library 0.7.6 | first = Ville | last = Laurikari|year = 2009 | ref = harv}}
*{{cite book
| first = Francois
| last = Liger
| authorlink = Francois Liger
| coauthors = [[Craig McQueen]], [[Paul Wilton]]
| year =2002
| title = Visual Basic .NET Text Manipulation Handbook
| publisher = [[Wrox Press]]
| isbn = 1-86100-730-2
}}
*{{cite book
| first = Michael
| last = Sipser
| authorlink = Michael Sipser
| year =1998
| title = Introduction to the Theory of Computation
| chapter = Chapter 1: Regular Languages
| pages = 31–90
| publisher = PWS Publishing
| isbn = 0-534-94728-X
| ref = harv
}}
*{{cite book
| first = Tony
| last = Stubblebine
| authorlink = Tony Stubblebine
| year =2003
| title = Regular Expression Pocket Reference
| publisher = O'Reilly
| isbn = 0-596-00415-X
}}
*{{cite web | url=http://dev.perl.org/perl6/doc/design/apo/A05.html | title=Apocalypse 5: Pattern Matching | first=Larry|last=Wall|authorlink=Larry Wall | year=2002}}
*{{cite book
| first = Jan
| last = Goyvaerts
| authorlink =
| coauthors = [Jan Goyvaerts], [Steven Levithan]
| year =2009
| title = Regular Expressions Cookbook
| publisher = [O'reilly]
| isbn = 978-0-596-52068-7
}}
{{Refend}}


== Cách viết ==
==Liên kết ngoài==
<!-- Please note: There are thousands of regex tools in existence. Since Wikipedia is not a repository of links (see [[WP:NOT]] and [[WP:LINKS]]), please do not add links to such resources. They will likely be removed. -->

{{wikibooks|Regular Expressions}}

* ISO/IEC 9945-2:1993 [http://www.iso.org/iso/catalogue_detail.htm?csnumber=17841 ''Information technology -- Portable Operating System Interface (POSIX) -- Part 2: Shell and Utilities'']
{{Sơ khai}}
* ISO/IEC 9945-2:2002 [http://www.iso.org/iso/iso_catalogue/catalogue_ics/catalogue_detail_ics.htm?csnumber=37313 ''Information technology -- Portable Operating System Interface (POSIX) -- Part 2: System Interfaces'']
* ISO/IEC 9945-2:2003 [http://www.iso.org/iso/iso_catalogue/catalogue_ics/catalogue_detail_ics.htm?csnumber=38790 ''Information technology -- Portable Operating System Interface (POSIX) -- Part 2: System Interfaces'']
* ISO/IEC/IEEE 9945:2009 [http://www.iso.org/iso/iso_catalogue/catalogue_ics/catalogue_detail_ics.htm?csnumber=50516 ''Information technology -- Portable Operating System Interface (POSIX®) Base Specifications, Issue 7'']
* [http://java.sun.com/docs/books/tutorial/essential/regex/index.html Java Tutorials: Regular Expressions]
* [http://perldoc.perl.org/perlre.html Perl Regular Expressions documentation]
* [http://msdn2.microsoft.com/en-us/library/ms974570.aspx VBScript and Regular Expressions]
* [http://msdn.microsoft.com/en-us/library/hs600312.aspx .NET Framework Regular Expressions]
* {{dmoz|Computers/Programming/Languages/Regular_Expressions|Regular Expressions}}
* [http://billposer.org/Linguistics/Computation/Resources.html#patterns Pattern matching tools and libraries]
* [http://doc.cat-v.org/bell_labs/structural_regexps/ Structural Regular Expressions by Rob Pike]
* JavaScript [https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Regular_Expressions Regular Expressions Chapter] and [https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp RegExp Object Reference] at the [[Mozilla Developer Center]]


{{DEFAULTSORT:Biểu thức chính quy}}
[[Category:Lý thuyết Automat]]
[[Category:So khớp mẫu]]
[[Category:Xây dựng lập trình]]
[[Category:Biểu thức chính quy]]
[[Thể loại:Ngôn ngữ hình thức]]
[[Thể loại:Ngôn ngữ hình thức]]
[[Thể loại:Logic toán]]
[[Thể loại:Logic toán]]

Phiên bản lúc 07:38, ngày 10 tháng 6 năm 2012

Biểu thức chính quy (tiếng Anh: regular expression, viết tắt là regexp, regex hay regxp) là một chuỗi miêu tả một bộ các chuỗi khác, theo những quy tắc cú pháp nhất định. Biểu thức chính quy thường được dùng trong các trình biên tập văn bản và các tiện ích tìm kiếm và xử lý văn bản dựa trên các mẫu được quy định. Nhiều ngôn ngữ lập trình cũng hỗ trợ biểu thức chính quy trong việc xử lý chuỗi, chẳng hạn như Perl có bộ máy mạnh mẽ để xử lý biểu thức chính quy được xây dựng trực tiếp trong cú pháp của chúng. Bộ các trình tiện ích (gồm trình biên tập sed và trình lọc grep) đi kèm các bản phân phối Unix có vai trò đầu tiên trong việc phổ biến khái niệm biểu thức chính quy.

Tham khảo

  • Aho, Alfred V. (1990). “Algorithms for finding patterns in strings”. Trong van Leeuwen, Jan (biên tập). Handbook of Theoretical Computer Science, volume A: Algorithms and Complexity. The MIT Press. tr. 255–300.Quản lý CS1: ref=harv (liên kết)
  • “The Single UNIX ® Specification, Version 2”. The Open Group. 1997. Chú thích journal cần |journal= (trợ giúp); |contribution= bị bỏ qua (trợ giúp)Quản lý CS1: ref=harv (liên kết)
  • “The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition”. The Open Group. 2004. Chú thích journal cần |journal= (trợ giúp); |contribution= bị bỏ qua (trợ giúp)Quản lý CS1: ref=harv (liên kết)
  • Cox, Russ (2007). “Regular Expression Matching Can Be Simple and Fast”.Quản lý CS1: ref=harv (liên kết)
  • Forta, Ben (2004). Sams Teach Yourself Regular Expressions in 10 Minutes. Sams. ISBN 0-672-32566-7.
  • Friedl, Jeffrey (2002). Mastering Regular Expressions. O'Reilly. ISBN 0-596-00289-0.
  • Gelade, Wouter; Neven, Frank (2008). Succinctness of the Complement and Intersection of Regular Expressions. tr. 325–336. Đã bỏ qua tham số không rõ |booktitle= (trợ giúp)Quản lý CS1: ref=harv (liên kết)
  • Gruber, Hermann; Holzer, Markus (2008). Finite Automata, Digraph Connectivity, and Regular Expression Size (PDF). 5126. tr. 39–50. doi:10.1007/978-3-540-70583-3_4. Đã bỏ qua tham số không rõ |booktitle= (trợ giúp)Quản lý CS1: ref=harv (liên kết)
  • Habibi, Mehran (2004). Real World Regular Expressions with Java 1.4. Springer. ISBN 1-59059-107-0.
  • Hopcroft, John E.; Motwani, Rajeev; Ullman, Jeffrey D. (2000). Introduction to Automata Theory, Languages, and Computation (ấn bản 2). Addison-Wesley.Quản lý CS1: ref=harv (liên kết)
  • Kleene, Stephen C. (1956). “Representation of Events in Nerve Nets and Finite Automata”. Trong Shannon, Claude E.; McCarthy, John (biên tập). Automata Studies. Princeton University Press. tr. 3–42.Quản lý CS1: ref=harv (liên kết)
  • Kozen, Dexter (1991). “Proceedings of the 6th Annual IEEE Symposium on Logic in Computer Science (LICS 1991)”: 214–225. Chú thích journal cần |journal= (trợ giúp); |contribution= bị bỏ qua (trợ giúp)Quản lý CS1: ref=harv (liên kết)
  • Laurikari, Ville (2009). “TRE library 0.7.6”.Quản lý CS1: ref=harv (liên kết)
  • Liger, Francois (2002). Visual Basic .NET Text Manipulation Handbook. Wrox Press. ISBN 1-86100-730-2. Đã bỏ qua tham số không rõ |coauthors= (gợi ý |author=) (trợ giúp)
  • Sipser, Michael (1998). “Chapter 1: Regular Languages”. Introduction to the Theory of Computation. PWS Publishing. tr. 31–90. ISBN 0-534-94728-X.Quản lý CS1: ref=harv (liên kết)
  • Stubblebine, Tony (2003). Regular Expression Pocket Reference. O'Reilly. ISBN 0-596-00415-X.
  • Wall, Larry (2002). “Apocalypse 5: Pattern Matching”.
  • Goyvaerts, Jan (2009). Regular Expressions Cookbook. [O'reilly]. ISBN 978-0-596-52068-7. Đã bỏ qua tham số không rõ |coauthors= (gợi ý |author=) (trợ giúp)

Liên kết ngoài