Removing redundant entries in RegExp
Posted: Tue Mar 22, 2005 1:25 am
Again another RegExp q:
I managed to do a pattern /..../is that will be give me the results. But there are some which are repeated - because they exist in the string to search for.
What do I have to do to get unique ones.
For example, a string may contain a lot of links in the form
<a id="12345" href="something">link</a>
My pattern matches 5 - there are 2 that are same. How do I remove redundant entries ? The result should be 4 matches.
Im using preg_match_all.
Thanks
I managed to do a pattern /..../is that will be give me the results. But there are some which are repeated - because they exist in the string to search for.
What do I have to do to get unique ones.
For example, a string may contain a lot of links in the form
<a id="12345" href="something">link</a>
Code: Select all
<a id="e;12345"e; href="e;something"e;>link</a>
<a id="e;54321"e; href="e;something"e;>link</a>
<a id="e;99999"e; href="e;something"e;>link</a>
<a id="e;12345"e; href="e;something"e;>link</a>
<a id="e;85858"e; href="e;something"e;>link</a>Im using preg_match_all.
Thanks