Jump to content

Replace problem


Ollifi

Recommended Posts

Hi, i started to play with JS replace function today.....but got problemsplease go to this address http://www.dealextreme.com/forums/Forums.d...threadid.739338 and write this to browser addressbar

java script:var sku=location.href;sku.replace("http:/www.dealextreme.com/forums/Forums.dx/Forum", "");sku.replace("/~~threadid.[0-9]/i", "");alert(sku);

I tried with firefox & Chrome but they both output a alert with text

http://www.dealextreme.com/forums/Forums.dx/Forum.24~threadid.739338

text should be

24

hopefully you could help me..thx!

Link to comment
Share on other sites

Check the characters in your URL. Your pattern to look for the numbers will also want to specify "1 or more", right now you're looking for only 1 digit following the dot (the dot probably needs to be escaped also, but probably won't matter). You also have 2 tildes in the second pattern.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...