I have been busting my head on this one for some time. Final scope: parse contents of php files (opened as text files) and get the first parameter of a function t().
Here is what I have so far:
<\?[(?:php)]{1}.*?t\(["'](.*?)["']\s*,*.*?\).*[\?>]*
For the following content, it should return "Test 1" through Test 18.
Here is the text (I am aware that there are syntax errors).
<?php t('Test 1') ?>
<?php t("Test 2") ?>
<?php= t("This should fail") ?>
<?php = t("This should fail") ?>
<?php =t("This should fail") ?>
<?=t("Test 3")?>
<?=
t("Test 4") ?>
<?= $vrum+$vrum;t('Test 5')?>
<?= t('Test 6') ?>
<?=t("Test 7",$a)?>
<?=t("Test 8 %s, %d",$b,$a)?>
<?=t("Test 9 %s, %d", $b, $a)?>
<?php echo t("Test 10");?>
<?php echot("This should fail");?>
<?phpecho t("This should fail");?>
<?php echo t('Test 11');?>
<?php echo t('Test 12 %s\'%d',$a , $b);?>
<?php echo t('Test 13 %s\'%d\'',$a , $b);?>
<?php echo t('Test 14 %s\'%d',t('Test 15') , $b);?>
<?php echo t('Test 16 %s\'%d', t('Test 17') , $b);?>
<?php echo T("This should fail");?>
<?php echo t("Test 18");
I'm having problems with what goes before the function, as it needs to be a valid php tag
<?php (followed by a space) or <?= (with or without space)
Can someone please point me in the right direction?
Thanks