in reply to Match a comma between two words

1. comma between two words like this - "Entries","Entry Time","Visit Length","Browser"

So this would be complicated by the fact that commas inside quoted text should not count, right? In other words, "Name, First","Name, Last","Birthday" should be split into "Name, First", then "Name, Last", and then "Birthday"?

I think that's starting to become a bit complicated for a single regex, though you could do it using match-time code evaluation and the \G assertion ("picking up where you left off"), perhaps, keeping track of whether you're in a quoted string or not as you go along.

A parser based on a formal grammar might be a better idea; take a look at Parse::RecDescent if you'd like to go that route.

Yet another option would be to use a loop and process the line in chunks: read from the beginning of (the current remainder of) the line up to the first comma or quote, keep track of whether you're in a quote right now etc., and use that information to either add the newly-read chunk to your current extracted column name, or increase your column counter and start a new column name with that chunk.

Since you want to learn how to do this on your own, I won't provide any code. :)

Now, all that said...

If commas are guaranteed to not appear in your quoted strings, everything becomes much easier, of course, \G alone should be enough to get the job done, though you could save yourself the trouble and simply split the line.

Hmm. I wonder if you could use split and then pull some clever tricks to glue the right bits together again in the general case, too. Well, you'll find out, if you decide to go down this route!

2. Match is multiple times a comma I tried many different regexes with no luck, please help!

I'm sorry, I don't know what you mean there.