0

I need to replace the source of some <img> in a HTML formatted string, but after I extract the URLs they don't match with the original string. This simple code should work, but it doesn't:

var str1:String = "<img src=\"file:///D:\\boo\\hoo\\hoo\\pic.jpg\">";
var str2:String = "file:///D:\\boo\\hoo\\hoo\\pic.jpg";
var i:int = str1.search(str2);

There is no match with src1.split(src2) either. I must be doing something wrong, but I can't figure out what.

1 Answers1

0

The answer of Jerry is right.

The pattern try to search the string with double backslash, you need 4 backslash.

You can read a explanation there.

Community
  • 1
  • 1
Nambew
  • 640
  • 5
  • 8