Reputation: 2695
I need to count number of arguments using regex for an i18n project like below
new Regex("\\{.*?\\}").findAllIn("{1},{2},{3} '{'4'}'").length
should return 3 instead of four. Can someone help with my regex?
Upvotes: 0
Views: 296
Reputation: 16286
If arguments can contain only digits, replace the pattern with this one:
\\{\\d+\\}
Upvotes: 3