introduction to parsing alphanumsmatches text that starts with an alphabetic character and that is followed by zero or more alphanumeric characters (both alphas and alphanums are predefined strings of characters provided by the pyparsing module less frequently used alternative to word(is charsnotin(this element is given string that it treats as set of charactersand will match all the characters from the current parse position onward until it reaches character from the given set of characters it does not skip whitespace and it will fail if the current parse character is in the given setthat isif there are no characters to accumulate two other alternatives to word(are also used one is skipto()this is similar to charsnotin(except that it skips whitespace and it always succeeds--even if it accumulates nothing (an empty stringthe other is regex(which is used to specify regex to match pyparsing also has various predefined parser elementsincluding restofline that matches any characters from the point the parser has reached until the end of the linepythonstylecomment which matches python-style commentquotedstring that matches string that' enclosed in single or double quotes (with the start and end quotes matching)and many others there are also many helper functions provided to cater for common cases for examplethe delimitedlist(function returns parser element that matches list of items with given delimiterand makehtmltags(returns pair of parser elements to match given html tag' start and endand for the start also matches any attributes the tag may have parsing elements can be quantified in similar way to regexesusing optional()zeroormore()oneormore()and some others if no quantifier is specifiedthe quantity defaults to elements can be grouped using group(and combined using combine()--we'll see what these do further on once we have specified all of our individual parser elements and their quantitieswe can start to combine them to make parser we can specify parser elements that must follow each other in sequence by creating new parser element that concatenates two or more existing parser elements together--for exampleif we have parser elements key and value we can create key_value parser element by writing key_value key suppress("="value we can specify parser elements that can match any one of two or more alternatives by creating new parser element that ors two or more existing parser elements together--for exampleif we have parser elements true and false we can create boolean parser element by writing boolean true false notice that for the key_value parser element we did not need to say anything about whitespace around the by defaultpyparsing will accept any amount of whitespace (including nonebetween parser elementsso for examplepyparsing treats the bnf definition key '=value as if it were written \skey \ '=\svalue \ (this default behavior can be switched offof course