Announcement

Collapse
No announcement yet.

preg_replace help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CeleronXT
    replied
    Er, elaborate a bit more and I think I'll be able to help.

    Leave a comment:


  • megahard
    started a topic preg_replace help

    preg_replace help

    ok basically i want to cut off numbers in page numbering

    the bottom line of code does as it shud

    the page number isnt a <a href=''> its just like [4]

    each number is seperated by a | hense the "\s\|\s"'s

    why doesnt the top one work?

    it cuts off only the last number for sum reason

    using "U" after the "#" doesnt work

    Code:
    // =======================
     // Cut off excess numbers
     // =======================
     $text = preg_replace('#\]\s\|\s(.*)\s\|\s(.*)#', '] | [url="file://\1"]\\1[/url] | ...', $text);
     $text = preg_replace('#(.*)\s\|\s(.*)\s\|\s(.*)\s\|\s\[#', '... [url="file://\2"]\\2[/url] | [url="file://\3"]\\3[/url] | [', $text);

Related Topics

Collapse

Working...
X