BornKillaz
11-07-2012, 11:14 PM
Hello all!
I'm posting this at the PHP section, because I'm working it with a php function.
So I need to grab the text between these HTML tags:
Votes )</small></span> </p>
The text I need, will appear in here. <p>
<div class="extravote-container-small">
So, I end up with something like this:
<?php
preg_match_all( '/Votes\s\)<\/small><\/span>\s<\/p>(.*?)\s<p>\s*<div\sclass="extravote-container-small">/si' , $page, $arr );
print_r( $arr[1]);
<?php
And that works just fine for strings similar to the above example. However there will be some strings that will contain a little JavaScript snippet (Google Adsense) right before the text I want, so what I need in addiction for the REGEX I mentioned above, is that when it finds something like this...
Votes )</small></span> </p>
<script type="text/javascript"><!--
google_ad_client = "pub-0000000000000000";
/* 728x90, created 00/00/00 */
google_ad_slot = "000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
And this is another text I need. <p>
<div class="extravote-container-small">
...it must not match that JavaScript section in the results.
Can someone please help me out on this?
I know I could use strip_tags() after getting the result all together, but I was avoiding it.
Thank you very much.
I'm posting this at the PHP section, because I'm working it with a php function.
So I need to grab the text between these HTML tags:
Votes )</small></span> </p>
The text I need, will appear in here. <p>
<div class="extravote-container-small">
So, I end up with something like this:
<?php
preg_match_all( '/Votes\s\)<\/small><\/span>\s<\/p>(.*?)\s<p>\s*<div\sclass="extravote-container-small">/si' , $page, $arr );
print_r( $arr[1]);
<?php
And that works just fine for strings similar to the above example. However there will be some strings that will contain a little JavaScript snippet (Google Adsense) right before the text I want, so what I need in addiction for the REGEX I mentioned above, is that when it finds something like this...
Votes )</small></span> </p>
<script type="text/javascript"><!--
google_ad_client = "pub-0000000000000000";
/* 728x90, created 00/00/00 */
google_ad_slot = "000000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
And this is another text I need. <p>
<div class="extravote-container-small">
...it must not match that JavaScript section in the results.
Can someone please help me out on this?
I know I could use strip_tags() after getting the result all together, but I was avoiding it.
Thank you very much.