I have this string (it’s an apple .strings file):
/* this is a comment line; it may contain semicolons */
"you have here some text; also may contain semicolons" = "some other text;";
/* this is a comment line; it may contain semicolons */
"you have here some text; also may contain semicolons" = "some other text;";
and so on.
I need to split this string after the semicolons at the end of each non-commented line.
If I use explode(";\n", $string); may not be accurate as the line could end in a ;(whitespace)(new line)
Update:
The output should be an array. Each element should contain the commented line (if exists) and the quoted strings line.
If you’re only concerned about the optional whitespace, you might get along with
preg_splittakes a regular expression whileexplodetakes a string as delimiter.