Results 1 to 3 of 3

Thread: RegExp failing in Firefox

  1. #1
    Join Date
    Oct 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post RegExp failing in Firefox

    I'm using a script that searches a string for specific text and uses the match() function to determine how many times that string appears within another string. Specifically I want to find out how many lines of text have the inline CSS "color:#00FF00;"

    Using the line str.match(/#00FF00/gi); seems to work fine in IE, but will not return any results in Firefox. Is there an error in my RegExp, or does Firefox just have an issue with searching for hex color codes? If I replace the script to search for a word, like "green" instead of the color code, it works on both browsers, but the default CSS color for "green" is not the color I want to use for the displayed text.

  2. #2
    Join Date
    Oct 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    a little update to my issue, which just makes this even more frustrating...
    if the color code is in the string outside the CSS code, the RegExp finds it fine, it's only when I have it listed as inline CSS style="color:#00FF00;" Firefox can't find it.

  3. #3
    Join Date
    Oct 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok...nvm... seems Firefox is changing the hex code to a rgb value...
    so basically I need to write it as str.match(/rgb\(0, 255, 0\)/gi); when running the page under Firefox...

Bookmarks

Posting Permissions

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