More RegEx

    Date: 12/12/07 (PHP Community)    Keywords: no keywords

    I had some assistance on here a week or so ago about replacing some text (which might be optional), and at first appeared to work. I modified slightly what I was was given to this result (the bullets you see are actually the output of the ascii equivalent):

    $rec = preg_replace('/•\s*(.*?)(?:\s*)?\s*(?:\r?\n)/i', '

    •$1

    ', $rec);

    So, when I use this regex in a query output to filter all records that may look like this:

    • Item 1

    • Item 2

    • Item 3



    it should turn into:

    • Item 1


    • Item 2


    • Item 3



    However, it seems to omit the first line search, so that I only get:

    • Item 2


    • Item 3




    Where in the regex can I change this so it doesn't omit anything?

    Source: http://community.livejournal.com/php/602886.html

« regex, match special char &... || Php backend setup? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home