It should be easy, but I managed to kick 2 people so far at work, and I have been on it for more than 3 hours, so it goes here.
I need to replace a + with aplus (along with several other cases) with the python re module. eg. "I passed the exam +". should be "I passed the aplus exam."
Just using \ ba + works great fine, but it doesnβt work in the case of + b, so I canβt use it, it must match the value + as a separate word. I tried \ ba + \ b, but this fails because I assume that the + character is a word boundary.
I also tried \ ba + \ W, which works, but is greedy and eats up space (or any other non-alpha char that will be there).
Any suggestions please?
python regex
dochead
source share