match - JavaScript Using Regex to split string by capital letters except when together -


i have function: var header = key.match(/[a-z][a-z]*/g);

this take string transactionid , make transaction d.

how make split except caps follow each other, in other words make into

transaction id or dob dob instead of d o b?

i see comments , have tried few things, problem function fed string of values make table header, , used several pages different headers.

 function constructheader(table, aligment, firstrow) {     var thead = document.createelement('thead');     table.appendchild(thead);     var tr = document.createelement('tr');     (var key in firstrow) {        var header = key.match(/[a-z][a-z]*/g);        var newheader = '';        (var = 0; <= header.length; i++) {          newheader += header[i] + ' ';        }     //  , on 

this takes transactionid , creates transaction d. how change becomes transaction id?

you can try :

key.match(/[a-z]+|[a-z]+[a-z]*/g); 

it work "myfakeid"

edit: star missing


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -