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

Bắt Control-Các Metacharacters metacharacters biểu hiện thường là ký tự không đại diện cho mình. Họ được ưu đãi với quyền hạn đặc biệt để cho phép bạn kiểm soát các mô hình tìm kiếm một cách nào đó (ví dụ, tìm các mô hình chỉ có ở đầu dòng, hoặc ở cuối dòng, hoặc nếu nó bắt đầu với chữ hoa chữ thường hoặc, vv.) | Getting Control The Metacharacters 733 EXPLANATION 1 A new array object is created. 2 The string apples pears peaches plums oranges is assigned to the variable called myString. The delimiters are a tab comma and colon. 3 The regular expression t is assigned to the variable called regex. 4 The String object s split method splits up the string using a tab colon or comma as the delimiter. The delimiting characters are enclosed in square brackets which in regular expression parlance is called a character class. See the section Getting Control The Metacharacters on page 733. In simple terms any one of the characters listed within the brackets is a delimiter in the string. The split method will search for any one of these characters and split the string accordingly returning an array called splitArray. 5 Each of the array elements is displayed in the page. See Figure . apples pears peaches plums oranges Figure The string is split on tabs colons and commas. Getting Control The Metacharacters Regular expression metacharacters are characters that do not represent themselves. They are endowed with special powers to allow you to control the search pattern in some way . find the pattern only at the beginning of line or at the end of the line or if it starts with an upper- or lowercase letter etc. . Metacharacters will lose their special meaning if preceded with a backslash. For example the dot metacharacter represents any single character but when preceded with a backslash it is just a dot or period. If you see a backslash preceding a metacharacter the backslash turns off the meaning of the metacharacter but if you see a backslash preceding an alphanumeric character in a regular expression then the backslash is used to create a metasymbol. A metasymbol provides a simpler form to represent some of the regular expression metachacters. For example 0-9 represents numbers in the range between 0 and 9 and d the metasymbol represents the same thing. 0-9 uses .

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.