View Single Post
Old 01-14-2005, 12:44 PM   #6
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
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.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote