Using mootools I have a regex like this:
new RegExp('^([^\\D'+ separator +']+)(\\d{2})');
In a string it inserts the char defined in separator after every 2 characters. I want it to insert only for the last two.
Example:
String Result
123456 12.34.56 // what it does now
123456 1234.56 // what it should do
I don’t have much experience with regex so any help or link to a decent tutorial is appreciated.
Don’t use regex for this:
Live DEMO
Of course you can check if the string length is bigger than 2
Or use string
slicefunction:How does it work?
I’ll break it into pieces: