Jump to content

Preg Replace


RobertP

Recommended Posts

i am in need of a regular expression that will parse my associative array keys into clean strings.

 

example:

testKeyString33 = Test Key String 33
dbHost = Db Host
simpleStringWithMore = Simple String With More

 

This is how i think it would work...

- append a space to all UPPER CASE letters (aSd = a Sd)

- append a space to the start of all integers... (asd123 = asd 123)

 

if this is confusing at all, please say so :S

Link to comment
https://forums.phpfreaks.com/topic/264847-preg-replace/
Share on other sites

no, it's a negative look-behind.  It checks to see if the character it is looking for isn't at the start of the string, by looking at the character that comes before it (the ^ signifies start of string, which isn't an actual character, but you get the idea).  Otherwise, you will end up with for instance "Abc" to " Abc"

Link to comment
https://forums.phpfreaks.com/topic/264847-preg-replace/#findComment-1357482
Share on other sites

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.