Jump to content

[SOLVED] Separate a String by Capital letters - eg. SonicYouth becomes Sonic Youth


transparencia

Recommended Posts

I'vefound a sample of code that works in a PHP script but not in a regex tool so I presume the regex is not well written. I would like to use with a regex tool or else I will have to create a PHP script to gather all the files and rename them.

 

The regex:

 

/(?<=\w)([[:upper:]])/

 

The PHP:

 

<?
$String="ILoveWeberdev";
$String = preg_replace('/(?<=\w)([[:upper:]])/', ' $1', $String);

echo $String
?>

 

Is something wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.