I need to add the string Sr.
at the beginning of a string if it is missing at all or has missing space or dot.
These strings...
Sr. Name
Sr.Name
Name
Sr Name
Sr name
Sr. name
sr.name
...should always result in the string Sr. Name
.
I tried to split the string: string.split['.']
, but this would not take all cases as shown above. So I tried some regex: string.replace(/Sr. /, 'Sr. ')
.