Slammer 0 Newbie Poster

Thanks for your answer. This is what i figured out yesterday evening.

$regexp = "#<a\s[^>]*href=\"([^\"]*)\"[^>]*>\s*{$criteria}\s*</a>#siU";

which is pretty similar to yours regexpr :-)

Slammer 0 Newbie Poster

try changing "$login_successful" == "1" to $login_successful == 1

if ("$login_successful" == "1") {
Slammer 0 Newbie Poster

Hi,

my problem is in regular expression. I need to catch from html code hyperlink tag's href atribute content if this hyperlink contains search condition.
here is snippet:

$a = "nail"; //search ctriteria between <a></a>
$s =<<<EOF
<a class="level2" onmouseout="this.style.background = '';" onmouseover="this.style.background ='#2c7cf4';" href="index.php?item&amp;module=1&amp;category=11" style="">  kaut kas cits </a>
<img> </img>
<br>
<a class="level2" onmouseout="this.style.background = '';" onmouseover="this.style.background ='#2c7cf4';" href="index.php?item&amp;module=1&amp;category=13" style="">  nails </a>
<a class="level2" onmouseout="this.style.background = '';" onmouseover="this.style.background ='#2c7cf4';" href="index.php?item&amp;module=1&amp;category=15" style="">  kaut kas cits2 </a>
EOF;
//this is how far i figured it out
$regexp = "#<a\s[^>]*href=\"([^\"]*)\"[^>]*>(.*{$a}+.*)</a>#siU";

/* rule explanation
# - store pattern
\s - whitespace char
. - any char (exclude newline)
* - 0 or more
? - match minimal string combo
s - (PCRE_DOTALL) modifier
i - match UPPER or lower case letters
^ - not
U - (PCRE_UNGREEDY) modif.
*/
//finding all hyperlinks
preg_match_all($regexp, $s, $matches);
// result must be 'index.php?item&amp;module=1&amp;category=13'
var_dump($matches);

it would be nice if you help me out with this regexp. Thanks!

Slammer 0 Newbie Poster

Hi there.

I need to write a recursive DFS function for graph which is implemented as follows:

struct nodes_arr
{
    unsigned int position[50000];
    unsigned int amount[50000];
    node *next[50000];
} nodes_table[] = {0};
struct node
{
    unsigned int position;
    unsigned int amount;
    node *next;
};

as a result i have a graph which for example looks like:

1:100->5:50->12:50
2:200->7:110->6:70->11:20
3:300->8:165->7:110
5:50->11:20->10:30
6:70
7:110->9:100
8:165
9:100
10:30
11:20
12:50
15:0->29:50
29:50

where first column is nodes_table->position (vertice) : nodes_table->amount (pointless in my problem here), and then pointers to structures (nodes_table->next) of nodes, if vertice links to another vertice.

Everything was fine for me till now when i need to write recursive DFS for this graph.

Given is total graph size. And count which in this example will be 3. Count stands for main (parent) vertices to whose are added child vertices from top. (in example - for vertices 1, 2, 3 all other vertices may be only as children)

Okey, returning to my problem:

1. I created array filled with 0's visited[50000] = {0} (50000 - because vertices position number is available from 1 to 50000) which we will mark with 1 if vertice is reachable and visited from first count vertices (in example from 1 to 3)
2. then tried to write recursive DFS

int visited[50000] = {0};

void error2_check(int count, int size)
{
    for(int i=0; i<size+1; i++)
        dfs(i, nodes_table->position[i]);
}

void dfs(int i, int pos)
{
    visited[pos] = 1;
    if(nodes_table->next[i] …