Results 1 to 5 of 5

Thread: [Resolved] Regular Expressions...

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [Resolved] Regular Expressions...

    I'm trying to run this code:

    Code:
    $msg = preg_replace('/\[\*\](.*)/siU', '<li>\\1</li>', $msg);
    And for some reason, it's replacing this:

    [*]text
    With

    <li></li>text
    ??
    Last edited by The Hobo; Aug 11th, 2003 at 12:33 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    works for me, bu tafter looking at the source I see it does what you got.

    <li></li>text

    let me look deeper.

  3. #3
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    take the U off the end of the reg. exp.

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    That fixes, that, but now, when I have:

    [*]text[*]text[*]text
    It does something like:

    <li>text[*]text[*]text</li>
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    It seems to work fine if I use an end tag [/*]:

    Code:
    $msg = preg_replace('/\[\*\](.*)\[\/\*\]/isU', '<li>\\1</li>', $msg);
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width