using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^([A-Z]+): (.*(?:\r?\n(?![A-Z]+: ).*)*)";
string input = @"SQL: SELECT `translation`.`string`, `translation`.`translate` FROM `translation` WHERE (store_id IN (0 , :store_id)) AND (locale = :locale) ORDER BY `store_id` ASC
BIND: array (
':locale' => 'en_US',
':store_id' => '3',
)
AFF: 0
TIME: 0.0003
TRACE: #1 xxx\Framework\DB\Logger\File[xxx\Framework\DB\Logger\LoggerAbstract]#0000000028783cd000000000748608f7#->getStats('query', 'SELECT `translat...', array(':locale' => 'en_US', ':store_id' => 3), &xxx\Framework\DB\Statement\Pdo\Mysql#0000000028783e1900000000748608f7#) called at [vendor/xxx/framework/DB/Logger/File.php:67]
#2 xxx\Framework\DB\Logger\File#0000000028783cd000000000748608f7#->logStats('query', 'SELECT `translat...', array(':locale' => 'en_US', ':store_id' => 3), &xxx\Framework\DB\Statement\Pdo\Mysql#0000000028783e1900000000748608f7#) called at [vendor/xxx/framework/DB/Logger/LoggerProxy.php:152]
#3 xxx\Framework\DB\Logger\LoggerProxy#0000000028783cba00000000748608f7#->logStats('query', 'SELECT `translat...', array(':locale' => 'en_US', ':store_id' => 3), &xxx\Framework\DB\Statement\Pdo\Mysql#0000000028783e1900000000748608f7#) called at [vendor/xxx/framework/DB/Adapter/Pdo/Mysql.php:547]
#4 xxx\Framework\DB\Adapter\Pdo\Mysql\Interceptor[xxx\Framework\DB\Adapter\Pdo\Mysql]#0000000028783ca800000000748608f7#->_query('SELECT `translat...', array(':locale' => 'en_US', ':store_id' => 3)) called at [vendor/xxx/framework/DB/Adapter/Pdo/Mysql.php:613]
#5 xxx\Framework\DB\Adapter\Pdo\Mysql\Interceptor[xxx\Framework\DB\Adapter\Pdo\Mysql]#0000000028783ca800000000748608f7#->query(&xxx\Framework\DB\Select#0000000028783eea00000000748608f7#, array(':locale' => 'en_US', ':store_id' => 3)) called at [generated/code/xxx/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:128]
#6 xxx\Framework\DB\Adapter\Pdo\Mysql\Interceptor#0000000028783ca800000000748608f7#->query(&xxx\Framework\DB\Select#0000000028783eea00000000748608f7#, array(':locale' => 'en_US', ':store_id' => 3)) called at [vendor/xxx/zendframework1/library/Zend/Db/Adapter/Abstract.php:811]
#7 xxx\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Zend_Db_Adapter_Abstract]#0000000028783ca800000000748608f7#->fetchPairs(&xxx\Framework\DB\Select#0000000028783eea00000000748608f7#, array(':locale' => 'en_US', ':store_id' => 3)) called at [generated/code/xxx/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:1610]
#8 xxx\Framework\DB\Adapter\Pdo\Mysql\Interceptor#0000000028783ca800000000748608f7#->fetchPairs(&xxx\Framework\DB\Select#0000000028783eea00000000748608f7#, array(':locale' => 'en_US', ':store_id' => 3)) called at [vendor/xxx/module-translation/Model/ResourceModel/Translate.php:90]
#9 xxx\Translation\Model\ResourceModel\Translate#0000000028783eeb00000000748608f7#->getTranslationArray(3, 'en_US') called at [generated/code/xxx/Framework/Translate/ResourceInterface/Proxy.php:95]
#10 xxx\Framework\Translate\ResourceInterface\Proxy#0000000028783ecd00000000748608f7#->getTranslationArray(NULL, 'en_US') called at [vendor/xxx/framework/Translate.php:380]
#11 xxx\TranslationGenerator\Model\Import\Translate[xxx\Framework\Translate]#0000000028783ede00000000748608f7#->_loadDbTranslation() called at [vendor/xxx/translation-generator/Model/Import/Translate.php:130]
#12 xxx\TranslationGenerator\Model\Import\Translate#0000000028783ede00000000748608f7#->loadData('frontend', false) called at [vendor/xxx/framework/App/Area.php:245]
#13 xxx\Framework\App\Area#0000000028783ec600000000748608f7#->_initTranslate() called at [vendor/xxx/framework/App/Area.php:216]
#14 xxx\Framework\App\Area#0000000028783ec600000000748608f7#->_loadPart('translate') called at [vendor/xxx/framework/App/Area.php:143]
#15 xxx\Framework\App\Area#0000000028783ec600000000748608f7#->load('translate') called at [vendor/xxx/framework/View/DesignLoader.php:55]
#16 xxx\Framework\View\DesignLoader#0000000028783ec200000000748608f7#->load() called at [vendor/xxx/framework/App/Action/Plugin/Design.php:48]
#17 xxx\Framework\App\Action\Plugin\Design#0000000028783edd00000000748608f7#->beforeDispatch(&xxx\Customer\Controller\Section\Load\Interceptor#0000000028783ed400000000748608f7#, &xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:121]
#18 xxx\Customer\Controller\Section\Load\Interceptor#0000000028783ed400000000748608f7#->xxx\Framework\Interception\{closure}(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:153]
#19 xxx\Customer\Controller\Section\Load\Interceptor#0000000028783ed400000000748608f7#->___callPlugins('dispatch', array(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#), array(array('designLoader', 'customerNotifica...', 'catalog_app_acti...', 'tax-app-action-d...', 'weee-app-action-...', 'storeCheck', 'contextPlugin', 'customer-app-act...', 'customer-segment...'))) called at [generated/code/xxx/Customer/Controller/Section/Load/Interceptor.php:39]
#20 xxx\Customer\Controller\Section\Load\Interceptor#0000000028783ed400000000748608f7#->dispatch(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/App/FrontController.php:162]
#21 xxx\Framework\App\FrontController\Interceptor[xxx\Framework\App\FrontController]#0000000028783ce800000000748608f7#->processRequest(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#, &xxx\Customer\Controller\Section\Load\Interceptor#0000000028783ed400000000748608f7#) called at [vendor/xxx/framework/App/FrontController.php:98]
#22 xxx\Framework\App\FrontController\Interceptor[xxx\Framework\App\FrontController]#0000000028783ce800000000748608f7#->dispatch(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:58]
#23 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->___callParent('dispatch', array(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#)) called at [vendor/xxx/framework/Interception/Interceptor.php:138]
#24 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->xxx\Framework\Interception\{closure}(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#25 xxx\Store\App\FrontController\Plugin\RequestPreprocessor#0000000028783f0400000000748608f7#->aroundDispatch(&xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#, &Closure#0000000028783c2500000000748608f7#, &xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:135]
#26 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->xxx\Framework\Interception\{closure}(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73]
#27 xxx\PageCache\Model\App\FrontController\BuiltinPlugin#0000000028783c5a00000000748608f7#->aroundDispatch(&xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#, &Closure#0000000028783c2500000000748608f7#, &xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:135]
#28 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->xxx\Framework\Interception\{closure}(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/Interception/Interceptor.php:153]
#29 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->___callPlugins('dispatch', array(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#), NULL) called at [generated/code/xxx/Framework/App/FrontController/Interceptor.php:26]
#30 xxx\Framework\App\FrontController\Interceptor#0000000028783ce800000000748608f7#->dispatch(&xxx\Framework\App\Request\Http#0000000028783d0b00000000748608f7#) called at [vendor/xxx/framework/App/Http.php:116]
#31 xxx\Framework\App\Http\Interceptor[xxx\Framework\App\Http]#0000000028783d4700000000748608f7#->launch() called at [generated/code/xxx/Framework/App/Http/Interceptor.php:24]
#32 xxx\Framework\App\Http\Interceptor#0000000028783d4700000000748608f7#->launch() called at [vendor/xxx/framework/App/Bootstrap.php:261]
#33 xxx\Framework\App\Bootstrap#0000000028783d9c00000000748608f7#->run(&xxx\Framework\App\Http\Interceptor#0000000028783d4700000000748608f7#) called at [pub/index.php:49]";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx