The character + represents one or more matched characters in the sequence and it will always return the longest matched sequence: local foo = "12345678bar123"Īs you can see, * is similar to +, but it accepts zero occurrences of characters and is commonly used to match optional spaces between different patterns. Patterns can be more useful with the help of repetition/optional modifiers, patterns in lua offer these four characters: Character In this example, string.match will find the first occurrence that isn't b, a or r. You can get the complement of the character set by starting it with ^: local foo = "bar123bar2341" You can use the % character with any other non-alphanumeric character, therefore, if you need to escape, for instance, a quote, you must use \\ before it, which escapes any character from a lua string.Ī character set, represented inside square brackets ( ), allows you to create a special character class, combining different classes and single characters: local foo = "bar123bar2341" The character % represents a character escape, making %? match an interrogation and %% match the percentage symbol. In addition to character classes, some characters have special functions as patterns: ( ) %. For instance, %D will match any non-digit character sequence: string.match("f123", "%D") -> f Character classĪs mentioned above, any upper-case version of those classes represents the complement of the class. For instance, the character sequence %a matches any letter, while its upper-case version represents all non-letters characters, all characters classes (a character sequence that, as a pattern, can match a set of items) are listed below. Both can be very similar, but Lua pattern matching is more limited and has a different syntax. Instead of using regex, the Lua string library has a special set of characters used in syntax matches. Throughout some examples, the notation ():function is used, which is equivalent to string.function(, ) because all strings have a metatable with the _index field set to the string table. ? match exactly 0 or 1 occurrence of previous character class lazy match 0 or more occurrences of previous character class + greedy match 1 or more occurrences of previous character class * greedy match 0 or more occurrences of previous character class represents the class which is the union of all characters in set. %g represents all printable characters except space ![]() String.gsub(str, pattern, repl ) - Replaces substrings (up to a max of n times) String.gmatch(str, pattern) - Returns a function that iterates through all matches in str String.match(str, pattern ) - Matches a pattern once (starting at index) String.find(str, pattern ]) - Returns start and end index of match in str This repo contains homework for the t o nmail. Repository of code related to my engineering. News aggregator following the UNIX philosophyĪGH_computer_science_engineering_thesis.git or gįirmware extractors for Agere Hermes I. Modular non-destructive audio/video processorĪn interpreter of the brainfuck language.ĭocuments concerning the driving of. ![]() ![]() Tools for the detection of textual entailment This demo implemented the bluetooth function.Īdvanced Volume Mixer - Gnome Shell ExtensionĪ program to collect, store, and visualize. netĪ gettext based translator for asciidoc. Git mirror of the acts_as_ferret Rails plugin.ĪCX100/ACX111/TNETW1450 wireless network.Ĭreate ROX application launchers for Zero.Īn interactive Imlib2 console for the X ers. The Adaptive Distributed SDN Controller ail. ![]() Repository dedicated to: Audio files, in.Īcme::Tie::Eleet - Perl extension to 5pE4k. Simple sqlite document database cli-interface. comĪ tool for SNI-based HTTPS filtering circumve. comĪ fork of msysgit/git for easier access to.Ĩ2ce68d27755bc509c78e0e279b635e275db32dc.gitĪbduco a tool for session tach supportĪbstract is going to be a scalable full ail. orgĬode for two dimensional pattern matchingĪnother attempt at creating a repo for. co mĪdult Text Adventure Framework for Flex an. comĬreate a mirror of other Zero Install sites C++ Emacs GMPC GNOME GTK IRC KDE Lisp Lua Minetest OpenGL ROX Rails Ruby SDL Tunnel6 Tuxanci arm asm assembly audio bsd c c89 c90 cli compiler constant constant_propagation dlang documentation fast filesystem freebsd game gentoo git gnome-mirror gnu java kernel linux mail mirror mpd multimedia music network perl php python qt qt4 tcc tccboot test textmode tiny tinyc tinycc video web x86 zexosĪ free, open-source game of ancient warfareĬreate a binary release from source gma il.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |