I have the following very simple Javascript-compatible regular expression:
<script type="text/javascript" id="(.+)" src="([^"]+)">
I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that the following will still match:
<script id="..." type="text/javascript" src="...">
<script src="..." id="..." type="text/javascript">
<script id="..." src="..." type="text/javascript">
Is it possible to allow the attributes to appear in any order without compromising its ability to collect the matching ID and src?
edit The string to match on is coming from innerHTML, making DOM traversal impossible. Also, I cannot use any third party libraries for this specific application.