Beginning Regular Expressions 2005 phần 5

Nếu mô hình được chỉnh sửa để AB * C, các chuỗi ký tự phù hợp là ABC, ABBC, AC, và ABBBBBBC. Mỗi chuỗi ký tự phù hợp bao gồm một chữ hoa A, theo sau bởi không hay nhiều chữ hoa B, theo sau bởi một chữ hoa C. Nếu mô hình được chỉnh sửa để AB + C, các chuỗi ký tự AC không còn phù hợp, bởi vì nó không có một chữ hoa B. | Regular Expressions in StarOffice Writer Quantifiers The use of quantifiers in Writer is standard. The and n m quantifiers are all available. The test file is shown here ABC ABBC AC A3C ABBBBBBC AbbCC The pattern AB C matches the character sequences ABC and AC as shown in Figure 12-3. Each of the matched character sequences consists of an uppercase A followed by zero or one uppercase B followed by an uppercase C. Figure 12-3 285 Chapter 12 If the pattern is edited to AB C the character sequences matched are ABC ABBC AC and ABBBBBBC. Each of the matched character sequences consists of an uppercase A followed by zero or more uppercase Bs followed by an uppercase C. If the pattern is edited to AB C the character sequence AC no longer matches because it does not have an uppercase B. The pattern AB C means Match an uppercase A followed by one or more uppercase Bs followed by an uppercase C. If the pattern is edited to AB 2 4 C only the character sequence ABBC matches because it is the only character sequence in the test text that has an uppercase A followed by between two and four uppercase Bs followed by an uppercase C. Modes Writer supports both case-insensitive the default and case-sensitive matching. The Match Case check box is the interface tool that controls which mode is used in matching. Character Classes The implementation of character classes in Writer is pretty much standard. Ranges are supported as are negated character classes. Writer does not support the d metacharacter which matches numeric digits or the w metacharacter which matches word characters. Therefore the regular expressions author must use the corresponding character classes 0-9 to match a numeric digit and A-Za-z to match both cases of alphabetic characters. The preceding character classes can be qualified by any of the quantifiers mentioned in the preceding Quantifiers section. The following test text .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
44    371    1    29-06-2024
Đã 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.