regular expression in strings
david.bear at asu.edu
Sat Oct 11 03:21:51 CEST 2003
I'm trying to understand how regex's are interpreted out of strings
objects. for example, If I have a string that has newline chars in
it, how can I get a re.split to respect where the newlines are?
>>> bs = 'in the begining, \n there were new lines, and in the end \nin lines'
>>> re.split('^in', bs)
['', ' the begining, \n there were new lines, and in the end \nin lines']
I want to split the string bs. a '^in' should have also match \nin
where \n is the newline char.
Ultimately I have a large string buffer that I want to split at each
occurence of a particular regular expression, where the result
contains everything from the occurence of the regex till the end of
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
"Beware the IP portfolio, everyone will be suspect of trespassing"
More information about the Python-list