Regex extract data from String

I have following string structure

abcd("Some value",
  "Some data", Value);

asd("xyz", "abc");


xyz("Values",
    "sesef",
    adfak);

I want to extract this as below

array[0]="abcd("Some value",
  "Some data", Value);"

array[1]=asd("xyz", "abc");

array[2]=xyz("Values",
    "sesef",
    adfak);

In above sample code spaces between the functions is not fix & newline inside the function is also not fix.

I tried using the following regex but it is not working

preg_match_all("/.*((.+?));/is", $input_lines, $output_array);


Source: regex

Leave a Reply