Im trying to replace the following string in php:
2011.11.12 20:06,Teal'c Ostus,Solid Pyroxeres 46521,Pyroxeres
With:
2011.11.12 20:06,Teal'c Ostus,Solid Pyroxeres,46521,Pyroxeres
NOTE: There are 5 comma separated values here
Time, Character, Item Type, Quantity, Item Group
Note there are still to be some spaces left behind such as between date and time and first and last name and item with multiple words in its name.
Additionally, it cannot replace the \r and \n as there are many rows like the one above
Here is the regex for Search:
And the regex for replace
Explanation:
The Regex for search
The Regex for Replace
I hope that explains a little bit the (helpful but sometimes confusing) “magic” of regular expression. A good tool to design and test regular expressions is called Expresso and can be find here. If you want an online help and regex library with expression tester, you’ll find it here