Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert space before capitalize character in a word using replace and regex in jquery

these are the words in array

    WorkNumber
    WorkType
    Version 
    Status
    Module
    Priority
    AssignedBy
    AssignedTo
    Subject 
    Details 
    EstimatedTime 
    ActualTime
    CreatedDate
    ModifiedDate

i need the output as following

Work Number
Work Type
Version 
Status
Module
Priority
Assigned By
Assigned To
Subject 
Details 
Estimated Time 
Actual Time
Created Date
Modified Date
like image 789
Thulasiram Avatar asked Sep 03 '25 03:09

Thulasiram


1 Answers

This is what you need :

"YourString".replace( /([a-z])([A-Z])/g, "$1 $2");

Will output :

"Your String"
like image 173
jbrtrnd Avatar answered Sep 04 '25 16:09

jbrtrnd