Regex Pattern Help
Posted: Wed Apr 07, 2010 6:21 pm
Hey all-
I'm having a hard time wrapping my head around the correct syntax for getting a matching (preg) regex pattern for this string (and similar):
They're CSV entries for color palettes, and I'm trying to write a quick tool that will just display a decent amount of these files easily.
I'm trying something along the lines of
...as I'd like to chunk them up by twos. The first 2 are red, next two are blue, last 2 being green. I know it's not right cause it doesnt work. I think I need to use lookaheads, but that's just slightly outside my experience with regex.
In the end I'd like
..etc. Once I get the regex pattern to match two-at-a-time I can take it from there.
Thanks
I'm having a hard time wrapping my head around the correct syntax for getting a matching (preg) regex pattern for this string (and similar):
Code: Select all
"0A","A2","13","FA","A9","218",
"31","125","43","1F","199","2B"I'm trying something along the lines of
Code: Select all
/(\"[^\"]{,3}\",?)+/In the end I'd like
Code: Select all
Array (
[0] => 0AA2
[1] => 13FA
[2] => A9218
)Thanks