PHP - Empty Regular Expression

LincLinc OwnerDetroit Icrontian
edited April 2004 in Internet & Media
I've been battling this error for a few hours now... :-/

Warning: Empty regular expression on line 84 (the last one listed here)

[php]$document = implode("", $member_array);

$search = array("'[" . $col_delim . "]+'", "'[" . $row_delim . "]+'", "\t", "'\"'");
$replace = array(" ", " ", $col_delim, "\\" . chr(34));

$tmp_text = preg_replace($search, $replace, $document);[/php]

I can't figure out why it's doing this... anyone have an idea? :scratch:

Comments

  • ShortyShorty Manchester, UK Icrontian
    edited April 2004
    Print or PM a bit what they are revelant to. A bit more information needed please mate.

    It's not always necessary to use a regex unless you have specific characters you wish to filter :)
  • a2jfreaka2jfreak Houston, TX Member
    edited April 2004
    $search = array("/'[" . $col_delim . "]+'/", "/'[" . $row_delim . "]+'/", "/\t/", "/'\"'/");


    If that doesn't work then make the / a /i and see if that works.

    You also might need to make the [ a \[
  • LincLinc Owner Detroit Icrontian
    edited April 2004
    [php]$col_delim = "&";
    $row_delim = "/";[/php]

    Suffice to say member_array is a long array of words and numbers so document is a long string. I've done "print"s on all 3 and they are the correct values.

    What other info did you want? :-/


    Those reg experessions I took from Lasse - they've been working for quite a while which is why I don't get this.

    a2j - I tried the first and got another error: Unknown modifier ']'
    a2jfreak wrote:
    f that doesn't work then make the / a /i and see if that works.
    You want me to put an 'i' after every slash?
  • LincLinc Owner Detroit Icrontian
    edited April 2004
    Ah... nevermind, I needed single quotes around the tab :) Thanks guys.
Sign In or Register to comment.