Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'professional information technology-programming book part 102', 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ả | This pattern is looking increasingly complex but it actually is not so let s look at it together. w matches any alphanumeric character but not . the valid characters with which to start an email address . After the initial valid characters it is indeed possible to have a . and additional characters although these may in fact not be present. w. matches zero or more instances of . or alphanumeric characters which is exactly what was needed. Note Think of as being the make it optional metacharacter. Unlike which requires at least one match matches any number of matches if present but does not require that any be present. is a metacharacter. To match an you ll need to escape it as . Matching Zero or One Character One other very useful metacharacter is . Like matches optional text and so zero instances will match . But unlike matches only zero or one instance of a character or set but not more than one. As such is very useful for matching specific single optional characters in a block of text. Consider the following example The URL is http www.forta.com to connect securely use https www.forta.com instead. http w. The URL is http www.forta.com to connect securely use https www.forta.com instead. The pattern used to match a URL is http which is literal text and therefore matches only itself followed by w. which matches one or more instances of a set that allows alphanumeric characters . and forward slash. This pattern can match only the first URL the one that starts with http but not the second the one that starts with https . And s zero or more instances of s would not be correct because that would then also allow httpsssss which is definitely not valid . The solution Use s as seen in the following example The URL is http www.forta.com to connect securely use https www.forta.com instead. https w. The URL is http www.forta.com to connect securely use https www.forta.com instead. The pattern here begins with https . means that the preceding character the s should be .