1

How can i "find" all elements with those id:

ctl00_cphContent_ctl05_Panel01,

ctl00_cphContent_ctl06_Panel01,

ctl00_cphContent_ctl07_Panel01,

ctl00_cphContent_ctl08_Panel01, etc...

I tried

foreach($html->find('a#ctl00_cphContent_ctl'.*.'_Panel01') as $positions) { echo "Test!";}

But it doesn't work! Can someone help me please? I search but didn't find something similar...

1 Answer 1

3

From reading the simple HTML DOM parses documentation http://simplehtmldom.sourceforge.net/manual.htm#section_find, I don't think that it includes full regex functionality. However it does seem to have basic matching. Try this:

$html->find( '[id^=ctl00_cphContent_ctl]' )

Obviously this wont just match id tags like ctl00_cphContent_ctl05_Panel01, but will also match things like ctl00_cphContent_ctrandomstuffhere. But it doesn't appear to be possible to do a full regexp match in the way you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.