HandyFile Find And Replace Online Help Submit feedback on this topic   

KB0006: I need to change strings from osCommerce format to phpBB

Question

I am working on a MOD to phpBB to integrate osCommerce and need all the language strings changed from the osCom format to the phpBB format.

I am wanting to write and expression to do the following but am having problems getting it to work: find code like this:

define('THIS_COULD_BE_ANYTHING', 'again anything');

and replace it with this

$lang['This_could_be_anything'] = 'again anything';

so that the first 'THIS_COULD_BE_ANYTHING' become capitalized.

Any pointers as to how to do this would be great - thanks. By the way - this is a great product, I use it at least once a week to update various files - searched through about 1000 files changing a couple of settings - fantastic ... well done.

Answer

This is very simple. We have to single out the two strings, the first one right after the opening bracket ending with the comma and the second one after the comma ending with the closing bracket.

Search expression
define\(\'([^\']+)\'\,\s+\'([^\']+)\'\)\;

where

Replace expression:
$lang['\u\L\1\E'] = '\2';

where