php - Replace all the first character of words in a string using preg_replace() -


i have string

this sample text. text used dummy "various" regex "operations" using php.

i want select , replace first alphabet of each word (in example : t,i,a,s,t,t,t,w,b,u,a,d,f,",r,",u,p). how do it?

i tried /\b.{1}\w+\b/. read expression "select character has length of 1 followed word of length" didn't work.

you may try regex well:

(?<=\s|^)([a-za-z"]) 

demo


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -