Concatenate 2 letters with preg_replace and regex
I have a list of company names to process, and send to various places
after formatting. My current issue is the following :
Example lines
J C PENNEY CO INC
DOLLAR TREE INC
C H ROBINSON WORLDWIDE INC
GOOGLE INC
I would like to concatenate the single letters J C , and C H into JC and
CH, so the final result reads :
JC PENNEY CO INC
DOLLAR TREE INC
CH ROBINSON WORLDWIDE INC
GOOGLE INC
This should happen only at the beginning of the word. I have no problem
finding the pattern, with /^\w\s\w\s/, but how can I remove the space in
the middle? Thanks for your help!
No comments:
Post a Comment