WordPress.org

Support

Support » How-To and Troubleshooting » regular expression problem for IE

regular expression problem for IE

  • This happens only in Internet Explorer but the javascript function sendToEditor() in inline-uploading.php doesn’t execute well in IE, while FF processes it fine.

    For example, this command

    h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes

    will replace <div id=photoinlayer><img src=file.jpg …
    as <div id=”photoinlayer”><img src=”file.jpg” … in Firefox but IE will produce
    <div id=”photoinlayer><img” src=”file.jpg…

    So it appears that the conditions ([^\'”][^ ]*)( |/|>) aren’t working properly in IE.

    Any ideas why?

Viewing 3 replies - 1 through 3 (of 3 total)
  • can anyone tell me what this translates to in the search: [^\'”][^ ]*

    I’m reading this but not getting it.

    edit: I’ve figured out that the above set means any character that is not ‘ or ” followed by any character that is not a space. Any chance IE doesn’t understand that? Or a tip on where I can find help on this?

    edit2: using ([^\'”][^ ]+?) seems to fix the problem for IE.

    Can anyone tell me if this is a valid solution, or why it should or shouldn’t be used?

    That fixed the trouble, although I had to separate the search for id and add it as a second replace.

    I still can’t figure out how to get
    h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames

    to work in IE.

    I’ve also found a place for help with Regex on this topic. Hopefully some solution will come of this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘regular expression problem for IE’ is closed to new replies.
Skip to toolbar