Regex for first element of word as Uppercase but in brackets should be Lowercase

234 Views Asked by At

I want to create regex which should work with tag. Example code is as follows:

<div class="numericGoalMetFooter ng-binding">
                    Total time(s)
</div>

If I use css text-transform: capitalize then output follows:

Total Time(S)

I want the text as follows:

Total Time(s)

Note : "time(s)" comes dynamically from database. Thanks in advance for your answers.

1

There are 1 best solutions below

0
On

As, I was using angularjs so I created custom filter and remove text css.

Angular custom filter:

app.filter('capitalize', function() {
        return function(input) {
            return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).toLowerCase() : '';
        }
    });

Html:

<div class="numericGoalMetUnit">
    Total {{challenge.unit  | capitalize}}
</div>