I have the following question.
How do you match a sentence, which is surrounded by commas(,), but the sentences can vary in size and number of words. For example:
Hi,How are you,bye
Thanks, I am very good,bye
So I want to match “How are you” and “I am very good”
I have tried something like
$_ =~ /,([\w\s\w\s\w,])/;
but that seems very wrong and will “possibly” match 3 words separated by space.
Wouldn’t a simple
/,(.+?),/do? Or/,([\w\s]+?),/if you want to be sure that you only have words and spaces?