Jump to content

grum

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

About grum

  • Birthday 04/04/1983

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Edinburgh, Scotland

grum's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That did the trick, cheers. Do you mind if I ask more about it? '/(?<!image=)\\b(https?|ftp|file):\/\/[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--][-A-Z0-9+&@#\/%?=~_|!:,.;][!--colorc--][/span][!--/colorc--]*[!--coloro:#33CC00--][span style=\"color:#33CC00\"][!--/coloro--][-A-Z0-9+&@#\/%=~_|] [!--colorc--][/span][!--/colorc--]/ie' In psuedo code, is that.. any number of these characters [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--][-A-Z0-9+&@#\/%?=~_|!:,.;] [!--colorc--][/span][!--/colorc--]followed by one of any of these characters [!--coloro:#33CC00--][span style=\"color:#33CC00\"][!--/coloro--][-A-Z0-9+&@#\/%=~_|][!--colorc--][/span][!--/colorc--]? If so, why? And I don't really get the word boundary thing. For my own curiosity, I tried your lookbehind statement and the word boundary at the start of my first code snippet. Why does it not work in that scenario? Thanks again! G.
  2. Hi guys, I hope everyone is well. Regex. Not my strong point. Any pointers appreciated. [code]$temp = preg_replace("/[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+/ie", "'<a href=\"\\0\" target=\"_blank\">'.urlreduce('\\0').'</a><div class=\"new_window\"> (Opens in new window) </div>\n'", $temp);[/code] The above code works fine, for an autolinking feature. But, I want it to ignore any URLs preceded by [code]image=[/code] I thought I could simply add a condition to the start of my match case, like so: [code]$temp = preg_replace("/[^image=][a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+/ie", "'<a href=\"\\0\" target=\"_blank\">'.urlreduce('\\0').'</a><div class=\"new_window\"> (Opens in new window) </div>\n'", $temp);[/code] It doesn't work though - still matches on URLs preceded by image=. Cheers for your help, G.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.