I have html with this sort of node value:
80% Polyester 10% Cotton 10% Rayon
It can also be like these:
90% Cotton 10% Rayon
Or:
100% Cotton
EDIT -- ALSO the text to capture might be more than one word like:
90% Egyptian Cotton 10% Polyester
What I need to do in PHP is change it to be like:
<li>80% Polyester</li>
<li>10% Cotton</li>
<li>10% Rayon</li>
I'm not sure how to get the capture group quite right... maybe there needs to be two capture groups that can happen 1+ times?
preg_match('/<p>([1-9]?[0-9]?% [^\d<]+|^100% )+<\/p>/', '<p>80% Polyester 10% Cotton 10% Rayon</p>', $matches);
This only finds 1 match for: 10% Rayon... what am I doing wrong for it not to capture all 3 groups?
EDIT: PLEASE FORGET ABOUT THE HTML TAGS
I stripped the tags from the question because people can't get over the whole regex and html issue... think of this as just a data string please.