So my string looks like this:
Basic information, advanced information, super information, no information
I would like to capture everything
This will capture up to but not including the second comma:
[^,]*,[^,]*
English translation:
[^,]*
= as many non-comma characters as possible
,
= a comma
[^,]*
= as many non-comma characters as possible
[...]
is a character class. [abc]
means "a or b or c", and [^abc]
means anything but a or b or c.
You could try ^(.*?,.*?),
The problem is that .*
is greedy and matches maximum amount of characters. The ? behind * changes the behaviour to non-greedy.
You could also put the parenthesis around each .*? segment to capture the strings separately if you want.