Regular expression, "except end of string", question.
dbasch at yahoo.com
Thu Jun 17 02:48:00 CEST 2004
In article <eppstein-EA7ACC.16384516062004 at news.service.uci.edu>,
eppstein at ics.uci.edu says...
> In article <MPG.1b3a76057bb1198d989681 at news-server.san.rr.com>,
> Derek Basch <dbasch at yahoo.com> wrote:
> > string = "WHITE/CLARET/PINK/XL"
> > which I need to alter to this format:
> > string = "WHITE-CLARET-PINK/XL"
> Do you really need regexps for this?
> >>> string = "WHITE/CLARET/PINK/XL"
> >>> '-'.join(string.split('/',2))
Thanks Peter and David,
It always comforting to know that a really simple solution exists after
you waste a couple of hours messing with Regular Expressions. :)
More information about the Python-list