RegEx Pattern Matching
The RegEx Pattern Matching feature allows you to replace specific terms or strings that may be present in your custom database.sql file. A good example of this is references to the URL of the WordPress site that was used to create the template package. In order to use RegEx pattern matching, simply enter your regex code (as shown below) into your configuration settings under Addons -> IBG App Installer - WP.
$regex = array(RegExValue => NewValue);
The following variables can be used to replace data with values generated in the module:
%tempurl% = WordPress Temporary URL
%customurl% = Custom URL as specified in your WordPress configuration settings.
%domainurl% = The domain assigned to the client.
%autourl% = The URL assigned to WordPress (any of the above) as specified in your WordPress configuration settings.
%urlprefix% = The URL prefix assigned to the WordPress site (e.g. either http:// or https://).
%serverip% = The client's server IP address.
%firstname% = The client's first name.
%lastname% = The client's last name.
%email% = The client's e-mail address (also the client's WordPress login).
%companyname% = The client's company name.
%address1% = The client's primary address line.
%address2% = The client's secondary address line.
%city% = The client's city.
%state% = The client's state/region.
%postcode% = The client's postcode.
%country% = The client's country.
%phonenumber% = The client's phone number.
%username% = The client's username for the hosting server.
%password% = The client's password for the hosting server.
%apppw% = The client's password for the WordPress account being provisioned.
%defaultblogname% = The default blog title stored in your WordPress configuration settings.
%defaultblogdesc% = The default blog description stored in your WordPress configuration settings.
Be sure to enclose any of the quick values in single quotes when adding to the regex array string (e.g. '%firstname%').
$customproductfields["field_name"] = Replace field_name with the name of the custom product field you want to retrieve the value for.
$customclientfields["field_name"] = Replace field_name with the name of the custom client field you want to retrieve the value for.
$configurableoptions["group_name"]["option_name"]["item"] = The item name of the specified configurable option. Replace group_name and option_name with the specific group and corresponding option that you want to retrieve the value for.
$configurableoptions["group_name"]["option_name"]["qty"] = The quantity of the specified configurable option. Replace group_name and option_name with the specific group and corresponding option that you want to retrieve the value for. Note: Yes/No fields return a quantity value of 1 for "checked" and 0 for "unchecked".
The default RegEx provided below will replace an existing temporary URL referenced in your database file with the temporary URL for the provisioned site:
$regex = array(
So if your client's temporary URL was http://111.222.333.444/~youruser and the site you used to create the WordPress package was http://555.666.777.888/~originalsite, the above RegEx code would replace http://555.666.777.888/~originalsite with http://111.222.333.444/~youruser.
The below example would replace any reference to the word WordPress (case-insensitive) to the term Awesome Site:
$regex = array(
Multiple replacement terms or patterns can be added by simply creating a seperate array key and value for each one:
$regex = array(
Starting in WordPress Auto-Provision Module v3.0.15, the following tables are excluded by default: _options, _usermeta, _users. Including these tables in the RegEx filtering process was causing site templates or user accounts to break in some instances. If you would like to include these tables in the RegEx search function, please add one of the following lines of code to the bottom of the sqlregex.php file:
To include the _options table, add this line:
$regex_options_table = 1;
To include the _usermeta and _users tables, add this line:
$regex_users_table = 1;
For assistance with constructing a proper RegEx string, please visit http://regex101.com or contact us with any questions.
Was this answer helpful?
The following language files are included in the WordPress Auto-Provision module by...
By default, the below e-mail template will be automatically added to your WHMCS e-mail templates...
The WordPress Package Builder tool helps you easily create your WordPress installation packages...
When creating or modifying WordPress package folders, please use the guidelines below to ensure...
Getting Started Download and install the latest release of the IBG App Installer - WP module...