Skip to content

Regular expression splitting multiple queries

Compare
Choose a tag to compare
@g105b g105b released this 09 Aug 15:28
· 53 commits to master since this release

Multiple CSS selectors can be present within the same query like this: div>a, div>li>a, and a simple explode() was being called to split the strings. However, this caused an issue when one selector was looking for an attribute selector whose value contained a comma.

To solve this, a regular expression has been used to split only commas that are not surrounded by quotes.