Author Topic: I need a bit of regex help..  (Read 400 times)

0 Members and 1 Guest are viewing this topic.

Online CosmosRPTopic starter

  • Irregular
  • Posts: 10
    • View Profile
I need a bit of regex help..
« on: March 13, 2010, 10:50:42 AM »
I currently have a regex:

Code: [Select]
(\074color\s*=\042[0-9A-Za-z]+?\042\s*\076.*<\057color>)
.. that matches " <color="hexcode/colorname">anything[wildcard]</color> "

However, I want to change this so that it matches: " lt;color=&quot;HEXCODE/COLORNAME&quot;&gt;ANYTHING[WILDCARD]&lt;/color&gt;


I imagine its just a simple matter of editing the original regex, but i'm really inexperienced when it comes to this stuff. Can someone help? =O

Offline cags

  • Guru
  • Fanatic
  • *
  • Posts: 3,250
  • Gender: Male
    • View Profile
    • TiB Studios
Re: I need a bit of regex help..
« Reply #1 on: March 13, 2010, 11:40:50 AM »
The only difference I can spot is the capitalization, is that what you were getting at? If that is the case then you should only need to add a modifier. I suggest you post the exact line of code you are using rather than just the regex as I'm guessing your using ereg, which is now deprecated.
CodeCanyon - Cheap, High Quality, Ready Made Scripts.

Offline sasa

  • Guru
  • Fanatic
  • *
  • Posts: 3,011
  • Gender: Male
    • View Profile
Re: I need a bit of regex help..
« Reply #2 on: March 17, 2010, 02:48:25 PM »
Code: [Select]
(&lt;color\s*=&quot;[0-9A-Za-z]+?&quot;\s*&gt;.*&lt;/color&gt;) or use htmlspecialchars_decode() function before regex