Message236715
The documentation states that "|" parsing goes from left to right. This doesn't seem to be true when spaces are involved. (or \s).
Example:
In [40]: mystring
Out[40]: 'rwo incorporated'
In [41]: re.sub('incorporated| inc|llc|corporation|corp| co', '', mystring)
Out[41]: 'rwoorporated'
In this case " inc" was processed before incorporated.
If I take the space out:
In [42]: re.sub('incorporated|inc|llc|corporation|corp| co', '', mystring)
Out[42]: 'rwo '
incorporated is processed first.
If I put a space with each, then " incorporated" is processed first:
In [43]: re.sub(' incorporated| inc|llc|corporation|corp| co', '', mystring)
Out[43]: 'rwo'
And If use \s instead of a space, it is processed first:
In [44]: re.sub('incorporated|\sinc|llc|corporation|corp| co', '', mystring)
Out[44]: 'rwoorporated' |
|
Date |
User |
Action |
Args |
2015-02-26 23:00:23 | Rick Otten | set | recipients:
+ Rick Otten, ezio.melotti, mrabarnett |
2015-02-26 23:00:23 | Rick Otten | set | messageid: <1424991623.26.0.907615110662.issue23532@psf.upfronthosting.co.za> |
2015-02-26 23:00:23 | Rick Otten | link | issue23532 messages |
2015-02-26 23:00:23 | Rick Otten | create | |
|