Rahul Tripathi Rahul Tripathi - 2 years ago 54
Javascript Question

I wana get only those string from file which start with #STA AND end With ;# from txt file using php



i want to ignore the last line which i have blockquoted and i want to get only those line which ends with ;# character.

Answer Source


preg_match("/(\#STA.*\;\#)/", $input, $output);

Edit: maybe it should be preg_match_all?

Edit2: http://www.phpliveregex.com/p/fCx

preg_match_all("/(\#STA.*?\;\#)/", $input, $output);
   Echo $output[1][$i];
   //$str .= $output[1][$i];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download