How to capitalize each letter coming after a particular string

Hello, I'm editing a PO translation file for a Wordpress website.
The former translator forgot to capitalize most first letters in sentences.

POedit doesn't allow me to capitalize each first letter, so I thought I'd use Notepad++ (but feel free to suggest something else).

I need to select each letter coming after this particular string: msgstr "
and capitalize it.

Maybe with Regex, not an expert though. Can somebody lend a hand? Thanks.
Daniele BrunengoIT Consultant, Web DesignerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

viki2000Commented:
Are you OK with Microsoft Word?
If yes, could you paster here a reference text just as example?
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Here's an extract. All words after 'msgstr "' need to begin with a capital letter.

#: E:\!our theme
#: wordpress\residence\!versions\1.09\wpresidence/libs/property.php:458
msgid "Bedrooms: "
msgstr "camere da letto:"

#: E:\!our theme
#: wordpress\residence\!versions\1.09\wpresidence/libs/property.php:467
msgid "Bathrooms: "
msgstr "bagni:"

#: E:\!our theme
#: wordpress\residence\!versions\1.09\wpresidence/libs/property.php:550
#: wordpress\residence\!versions\1.09\wpresidence/templates/submit_templates/property_location.php:173
msgid "Place Pin with Property Address"
msgstr "posizionare Pin con indirizzo dell'immobile"

Open in new window

viki2000Commented:
Could you confirm if after msgstr string is always space+quotation mark before the word that you want to capitalize starts?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Yes it is.
viki2000Commented:
Then I guess one solution would be to import it in Microsoft Word and use some VBA code.
Search for the string <msgstr "> and then find the letter/character following that string. Then capitalize it.
I do not know all the steps now, but this is how I would do it.
The difficulty that I have now is to find the character after that string. The string itself is easy to find, but to specify the following letter I have no idea for the moment. The rest should not be so complicated.
Let's see what other people suggest. If in mean time I have a solution I will let you know.
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Thanks. I think Regex should allow to select the following character, but I'm not sure.
aikimarkCommented:
The regex find pattern should be simple enough.
\. +[a-z]

The replacement will depend on the tool you are using.
aikimarkCommented:
This pattern is a bit more inclusive:
(?:^|\. +)([a-z])
sarabandeCommented:
you could use the macro Recorder in visual Studio (download vs express or vs community for free if not available).

open the text file in the vs text editor.

CTRL+SHIFT+R   starts the macro Recorder
CTRL+F         opens search window
msgstr "       enter this at Find What
               check find options 'Match case' and 'Match whole word'
F3             leaves find window and selects search string
<--            cancels selection 
CTRL+-->       moves text cursor to " without selection
-->            moves to first character after "
CTRL+SHIFT+U   capatalizes first character after "
CTRL+SHIFT+R   ends macro recording

Open in new window


now you could use the macro by CTRL+SHIFT+P until all occurrences were changed.

note, of course you could use any macro recorder for this task. some control sequences may differ, though.

Sara
William NettmannPHP Web DeveloperCommented:
Simplest solution:
<?php
$text = "Your file's contents";
$Text = str_replace('['msgstr "a','msgstr "b','etc',],['msgstr "A','msgstr "B','Etc',],$text);

Open in new window


str_replace() will replace each occurrence of a string in the first array with the equivalent string in the second array by position.

You could use a loop to create the arrays first to cut down on typing.
aikimarkCommented:
If you have Notepad++ with the TextFX plug-in installed, you can select all the text and do the following on the menu bar:
TextFX | TextFX Characters | Sentence Case

Note: The "|" represents the appearance of a sub menu
William NettmannPHP Web DeveloperCommented:
The whole thing:
for ($c = 97; $c <= 122; $c++) {
  $lowercase[] = 'msgstr "' . chr($c);
  $uppercase[] = 'msgstr "' . chr($c - 32);
}
$text = "Your Text";
$Text = str_replace($lowercase, $uppercase, $text);

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
That worked great. It was the only solution to actually solve the problem in one step. I thank you all for your input.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software

From novice to tech pro — start learning today.