Saturday, 24 December 2011

Extracting unknown text to create variable

Extracting unknown text to create variable

I am needing to extract unknown text out of a string and set it as a variable. Here is the pattern I am dealing with:

Code:

Category:</span> Soups and Chowders</p>
I need to set whatever the category is as a variable. In this case it would be:

myCategory="Soups and Chowders"

but it could be Cookies or Main Dishes, etc.

In any case, there's always one whitespace after Category:</span> and never a whitespace between the actual recipe category and </p>

No comments:

Post a Comment