Support multiple delimiters
See original GitHub issueToday there is only support for a single delimiter, so some more complex patterns can’t be done.
Some examples:
999.999.999-99BR CPF (like US social security for BR people)(99)99999-9999BR phone
My proposal to fix that is add delimiters option that would take a array of delimiters, each to be used one time in the rigth order between blocks. This wouldn’t add breaking changes. Maybe some validations should be applied like not allowing both delimiter and delimiters at the same time, and delimiters.length === blocks.length - 1.
The options passed to a CPF input would be
{
blocks: [3,3,3,2],
delimiters: ['.', '.', '-'],
numericOnly: true
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Splitting a Java String by Multiple Delimiters - Baeldung
Learn different options for splitting an input string by multiple delimiters using regular expressions, Google Guava, and Apache Commons.
Read more >Use String.split() with multiple delimiters - java - Stack Overflow
I think you need to include the regex OR operator: String[]tokens = pdfName.split("-|\\."); What you have will match: [DASH followed by DOT together]...
Read more >Using multiple characters as delimiters in Excel Text to Column
Using multiple character as delimiters in Excel Text to Column where the standard text to column only allows a single character delimitor.
Read more >HOW TO: Handle multi-character delimiters in flat-file sources ...
Click Advanced. Enter the delimiter characters under Column Delimiters. Under the Others section select Treat multiple delimiters as AND:.
Read more >Solved: How to import a txt file with multiple delimiters?
You can define more than one character as delimiter. As long as a delimiting character can't also be a valid character in another...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Release published. Please see: https://github.com/nosir/cleave.js/blob/master/doc/options.md#delimiters Won’t change
blocksusage, that will confuse other users.A demo is added to homepage: http://nosir.github.io/cleave.js/
Cheers.
Another way would be to supercharge the
blocksoption:Which would be nice for other uses as well: