A subexpression is also called a marked subexpression, a block or a capturing group. The string matched within the parentheses can be recalled later (see the next entry, \ n). For example, ab* matches " a", " ab", " abb" and so on, while \(ab\)* matches "", " ab", " abab", " ababab", and so on. This is not found in a few older instances of regular expressions.ĭefines a subexpression. For example, a\ matches only " aaa", " aaaa", and " aaaaa". Matches the preceding element exactly m times. For example, ab*c matches " ac", " abc", " abbbc", etc. Matches the preceding element zero or more times. Matches the ending position of the string, if it is the last character of the regular expression. Matches the starting position within the string, if it is the first character of the regular expression. The expression may also contain character classes, equivalence classes, and collating characters. The ] character is treated as a literal character if it is the first character after ^: abc]. The - character is treated as a literal character if it is the last character or the first characted after ^. These forms can be mixed: matches any character other than " a", " b", " c", " x", " y", or " z". For example, matches any character other than " a", " b", or " c", and matches any single character that is not a lowercase letter from " a" to " z". Matches a single character that is not contained within the brackets. The bracket expression may also contain character classes, equivalence classes, and collating characters. The ] character can be included in a bracket expression if it is the first character: abc]. The - character is treated as a literal character if it is the last or the first character within the brackets. These forms can be mixed: matches " a", " b", " c", " x", " y", or " z", as does. For example, matches " a", " b", or " c", and specifies a range which matches any lowercase letter from " a" to " z". Matches a single character that is contained within the brackets. For example, a.c matches " abc", etc., but matches only " a", ". Within POSIX bracket expressions, the dot character matches a literal dot. Matches any single character (many applications exclude newlines, and exactly which characters are considered newlines is flavor, character encoding, and platform specific, but it is safe to assume that the line feed character is included). The exceptions, listed below, are called metacharacters or metasequences. In POSIX Basic Regular Expression syntax, most characters are treated as literals - they match only themselves (e.g., a matches " a"). These standards were designed mostly to provide backward compatibility with the traditional Simple Regular Expressions syntax, providing a common standard which has since been adopted as the default syntax of many Unix regular expression tools. The POSIX Basic Regular Expressions syntax was developed by the IEEE, together with an extended variant called Extended Regular Expression syntax. Traditional Unix regular expression syntax followed common conventions that often differed from tool to tool.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |