TAILIEUCHUNG - Học JavaScript qua ví dụ part 82

một biểu hiện thường xuyên là gì? Người dùng được yêu cầu điền vào một mẫu HTML và cung cấp của mình, tên, địa chỉ, ngày sinh. Trước khi gửi mẫu đi tới một máy chủ để xử lý, một chương trình JavaScript kiểm tra hình thức để đảm bảo người sử dụng thực sự bước vào một cái gì đó, và các thông tin có định dạng yêu cầu. | chapter 17 Regular Expressions and Pattern Matching What Is a Regular Expression A user is asked to fill out an HTML form and provide his or her name address and birth date. Before sending the form off to a server for further processing a JavaScript program checks the form to make sure the user actually entered something and that the information is in the requested format. We saw in Chapter 11 Working with Forms and Input Devices some basic ways that JavaScript can check form information but now with the addition of regular expressions form validation can be much more sophisticated and precise. Regular expressions are also useful for searching for patterns in input data and replacing the data with something else or splitting it up into substrings. This chapter is divided into two main parts 1. how to create regular expressions and regular expression metacharacters and 2. how to validate form input data with regular expressions. If you are savvy with Perl regular expressions or the UNIX utilities grep sed and awk you can move rapidly through the first section because JavaScript regular expressions for the most part are identical to those found in Perl. A regular expression is really just a sequence of characters that specify a pattern to be matched against a string of text when performing searches and replacements. A simple regular expression consists of a character or set of characters that matches itself. The regular expression is normally delimited by forward slashes for example abc . Like Perl JavaScript1 provides a large variety of regular expression metacharacters to control the way a pattern is found. A metacharacter is a special character that represents something other than itself such a a A and so on. They are placed within in the regular expression to control the search pattern for example Aabc means look for the pattern abc at the beginning of the line. With the help of metacharacters you can look for strings containing only digits only alphas a .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.