Okay, I see. The right bracket doesn't like being in a character class.
To get PhpDig to accept [ and ] in links, incorporate the following:
PHP Code:
$link = "http://www.domain.com/dir/index.php?razdel=about&mach[2]=20";
$no_one = "[:%/?=&;\\,._a-zA-Z0-9\|+ ()~-]*";
$no_two = "[:%/?=&;\\,._a-zA-Z0-9 ()~-]*";
if (eregi("($no_one\[?$no_one\]?$no_one)",$link,$regs)) {
echo $regs[1];
}
if (eregi("($no_two\[?$no_two\]?$no_two)",$link,$regs)) {
echo $regs[1];
}
// both print http://www.domain.com/dir/index.php?razdel=about&mach[2]=20
For example, you can probably replace both character classes with:
Code:
[:%/?=&;\\,._a-zA-Z0-9|+ ()~-]
And then assign a variable like so:
PHP Code:
$no_brackets = "[:%/?=&;\\,._a-zA-Z0-9|+ ()~-]*";
And then use the following:
Code:
($no_brackets\[?$no_brackets\]?$no_brackets)
in place of:
Code:
([:%/?=&;\\,._a-zA-Z0-9\|+ ()~-]*)
and in place of:
Code:
([:%/?=&;\\,._a-zA-Z0-9 ()~-]*)
in the two regexs.