I am trying to split the variable based on the blank line. the variable is
$s = "iSCSI cred number=0
name=match1
string=2
name=number1
iSCSI cred number=1
name=match2
string=3
name=number2
iSCSI cred number=2
name=match3
string=4
name=number3";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s nothing to it:
Alternatively you can split on multiple whitespace characters with positive lookahead for the string
iSCSI:That works for your simple case, no matter if the whitespace characters are line feeds, carriage returns or spaces.