[Tutor] Parsing Strings
Sat, 19 Aug 2000 14:10:33 +1000
Sean 'Shaleh' Perry wrote:
> On 18-Aug-2000 Perry, George W. wrote:
> > Is there a module with functionality similar to the REXX parse statement?
> what is the "REXX" parse statement? To modules to look at in python are
> 'string' and 're'.
It's a simple pattern matching syntax that can be used to split text
into variables according to a pattern (eg "parse pull"), match text, and
so on. It's easy to split a string with individual tokens separated by
whitespace into a set of variables using "parse".
The answer is yes, using the regular expression package "re." The
regular expression syntax is more complex than the parse syntax, but
also more powerful. At a pinch you could write your own "parse" module,
since it's easy enough to translate parse statements into regular