How can I parse the following string:
Phone + 300 mins & unlimited texts – 24 month plan $25
to obtain the bracketed values, i.e.
Phone + [300] mins & [unlimited] texts – [24] month plan $[25]
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.
Depends, if they all look like that, then:
/Phone \+ (\w+) mins & (\w+) texts - (\d+) month plan \$(\w+)/That assumes that a plan may contain unlimited minutes.
You can use the regex like this:
now match is
["Phone + 300 mins & unlimited texts - 24 month plan $25", "300", "unlimited", "24", "25"]