Hi all, am using a regex (in php), but I'm all confused.
I'm trying to replace a string ('di') with 'deu'. SImple enough, but I don't want a replacement if 'di' is preceded by 'io' as in 'iodine', 'iodic', 'iodide' etc.
This is what I have:
'/(?<!io)di/i'
It works fine for everything, but unfortunately it doesn't stop the 'iodi' from becoming 'iodeu'. Any light on this would great. Thank you.
BTW:
I'm actually trying to create a chemical translation function, which means 'di' as in 'two of' should change to 'deu', but everything else should not change.
Unfortunately, I've found '..thiodi..' which should change to '..thiodeu..', just to complicate matters.
So 'di' and 'thiodi' should be replaced but not 'iodi'.
/?EDIT
'/(?<!o)di/i'
This works as expected.