![]() Print( "string.match('Apple', 'Apples') : ", string.match("Apple", 'Apples')) Print( "string.match('Apple', 'Apples?') : ", string.match("Apple", 'Apples?')) Print( "string.match('Apples', 'Apples?') : ", string.match("Apples", 'Apples?')) you can specify a range of characters using. Print( "string.find( str, 'lua') : ", string.find( str, 'lua')) Print( "string.find( str, 'pl') : ", string.find( str, 'pl')) – -: This is a lazy match which matched 0 or more occurrences of previous character class.?: This is a match exactly which matches 0 or 1 occurrence of previous character class.*: This is a greedy match which matches 0 or more occurrences of previous character class.+: This is a greedy match which matches 1 or more occurrences of previous character class.: This is a special sequence which matches the complement of set.: This is a set which matches the class which is the union of all characters in set.%c: This is a special sequence which matches all control characters.%g: This is a special sequence which matches all printable characters except space. ![]() %p: This is a special sequence which matches all punctuation characters.%x: This is a special sequence which matches all hexadecimal digits.%s: This is a special sequence which matches all whitespace characters.%d: This is a special sequence which matches all digits.%u: This is a special sequence which matches all uppercase letters.%l: This is a special sequence which matches all lowercase letters.%a: This is a special sequence which matches all letters.– : This is a metacharacter which matches all characters. The Lua programming offers a set of metacharacters, special sequence and sets which have a special meaning as listed below: gsub(string, pattern, repl ): This function used to replace the matched string by substrings and n specify the n number of replacement.gmatch(string, pattern): This function returns a function which iterates through all matches pattern in string.match(string, pattern ): This function matches a pattern once the matching starts at the given index.find(string, pattern ]): This function returns to start and end index of a match pattern in a string.Web development, programming languages, Software testing & others Start Your Free Software Development Course
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |