J
Jeremy
I am using re.split to... well, split a string into sections. I want
to split when, following a new line, there are 4 or fewer spaces. The
pattern I use is:
sections = re.split('\n\s{,4}[^\s]', lineoftext)
This splits appropriately but I lose the character matched by [^s]. I
know I can put parentheses around [^s] and keep the matched character,
but the character is placed in it's own element of the list instead of
with the rest of the lineoftext.
Does anyone know how I can accomplish this without losing the matched
character?
Thanks,
Jeremy
to split when, following a new line, there are 4 or fewer spaces. The
pattern I use is:
sections = re.split('\n\s{,4}[^\s]', lineoftext)
This splits appropriately but I lose the character matched by [^s]. I
know I can put parentheses around [^s] and keep the matched character,
but the character is placed in it's own element of the list instead of
with the rest of the lineoftext.
Does anyone know how I can accomplish this without losing the matched
character?
Thanks,
Jeremy