I have decided to port a web 2.0 application to Revolution.
The existing app has a backend written in PHP, and uses many regular expressions to detect pattern matches particularly in addressing data.
Example PHP code (without wishing anyone to slide into depression).
Code: Select all
$subject = "Westfield Shopping Town, Shop 1400-1402 Kingsway Miranda NSW 2228";
$pattern = '[Shop [0-9]+[-][0-9]+]';
preg_match($pattern, $subject, $matches);
$subject2 = "Westfield Shopping Town, Shops 1400-1402 Kingsway Miranda NSW 2228";
$pattern2 = '[Shops [0-9]+[-][0-9]+]';
preg_match($pattern2, $subject2, $matches2);
$subject3 = "Westfield Shopping Town, Shop 1400/140 Kingsway Miranda NSW 2228";
$pattern3 = '[Shop [0-9]+[/]]';
preg_match($pattern3, $subject3, $matches3);
print_r($matches);
// results in
Array ( [0] => Shop 1400-1402 )
print_r($matches2);
// results in
Array ( [0] => Shops 1400-1402 )
print_r($matches3);
// results in
Array ( [0] => Shop 1400/ )
I understand from the respective guides for PHP and Rev that RegExp are based on PCRE - all good. It might then be reasonable to expect the reg exp syntax will not differ greatly then (here's hoping).
I want to retrieve the matching text (if any) like in my PHP examples above. I am using matchText with a variable pre-defined so I can capture the FoundTextVarsList.
So my example Rev code may be:
Code: Select all
put "Westfield Shopping Town, Shops 1400-1402 Kingsway Miranda NSW 2228" into varTarget
put empty into varMatchingText
matchText(varTarget,"([Shop [0-9]+[-][0-9]+])",varMatchingText)
put varMatchingText into field "dinosaur"
Any assistance greatly appreciated,
Kind regards, Andrew