I'm just starting out with regular expressions and wonder how would I go about this please:
After returning a MS SQL database field name of , say,
$field_name = "Print_Paragraph_1";
how can I use a regular expression to change this so that
$fields_name = "Print paragraph 1:"
please?
(change all letters, other than the first letter, to lower case, replace underscores with spaces and append a colon).
Regular expression
Moderator: General Moderators
Re: Regular expression
Dunno about regular expression, but this seems easier...
Code: Select all
$word = 'Print_Paragraph_1';
$field_name = str_replace('_', ' ', ucwords(strtolower($word))).':';Re: Regular expression
Yes, JAM, that is easier. Many thanks for your reply.