tailieunhanh - Professional Information Technology-Programming Book part 108
Tham khảo tài liệu 'professional information technology-programming book part 108', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Information about Bluetooth and more. BODY hH 1 . hH 1 BODY H1 Welcome to my Homepage H1 Content is divided into two sections BR H2 ColdFusion H2 Information about Macromedia ColdFusion. H2 Wireless H2 Information about Bluetooth and more. BODY The pattern hH 1 . hH 1 matched the first header from H1 until H1 and would also match h1 as HTML is not case sensitive . But what pattern could be used to match any header which may be using any of the six valid header levels One option would be to use a simple range instead of 1 like this BODY H1 Welcome to my Homepage H1 Content is divided into two sections BR H2 ColdFusion H2 Information about Macromedia ColdFusion. H2 Wireless H2 Information about Bluetooth and more. BODY hH 1-6 . hH 1-6 BODY H1 Welcome to my Homepage H1 Content is divided into two sections BR H2 ColdFusion H2 Information about Macromedia ColdFusion. H2 Wireless H2 Information about Bluetooth and more. BODY That seemed to work hH 1-6 matches any header start tag H1 and H2 in this example and hH 1-6 matches any header end tag H1 and H2 . Note Notice that . lazy was used here and not . greedy . As explained in Lesson 5 Repeating Matches quantifiers such as are greedy and so pattern hH 1-6 . hH 1-6 could match all the way from the opening H1 on the second line until the closing H2 on the sixth line. Using the lazy quantifier . instead solves this problem. I said could and not would because this specific example would probably have worked even with the greedy quantifier. Metacharacter . usually does not match line breaks and in the example each header is on its own line. But there is no downside to using the lazy quantifier here so better safe than sorry. Success Not exactly. Look at the following example using the same pattern BODY H1 Welcome to my Homepage H1 Content is divided into two sections BR H2 ColdFusion H2 Information about Macromedia ColdFusion. H2 Wireless H2 Information about Bluetooth and more. H2 This is .
đang nạp các trang xem trước