fork download
  1. <?php
  2.  
  3. $input_str = 'Some text is here......[$radio_yes: He is eligible for PF. / $radio_no: He is not eligible for PF.]....Some text is here';
  4. $control_name = 'radio_yes';
  5.  
  6. preg_match_all('/^(.*?)\[(.*?)\](.*?)$/si', $input_str, $matches, PREG_PATTERN_ORDER);
  7. $before = $matches[1][0];
  8. $controllerRaw = $matches[2][0];
  9. $after = $matches[3][0];
  10.  
  11. preg_match_all("/$control_name:(.*?)\./si", $controllerRaw, $controller, PREG_PATTERN_ORDER);
  12. $controller = $controller[1][0];
  13. echo "$before $controller $after";
  14.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Some text is here......  He is eligible for PF ....Some text is here