Reputation:
I need to replace text into link in
Link must be look like " href="/search?q=$oldtext" title="$oldtext" ". $oldtext is text to replace.
I'm tried to use loop to find text with regexp "/^\x23\w/",and replacing with variable that contain generated link. And it result to nothing. I've edit regexp to "/\x23/" and get replacing for "#" (\x23 in hex as I hope=)) char only in the text mode=(
Help me, I'm stuck
Update: I have text block between [span class="text2replace"]super text #replacemetolink[/span] I need to replace #replacemetolink into link [a href="/timeline/search?q=#replacemetolink" title="#replacemetolink" class="search-link"]. I'm triying to make usejs for Opera to Twitter to replace #hashtags into link for searching this hashtag using Twitter search
Upvotes: 0
Views: 812
Reputation: 1595
Have you tried:
var newText = 'Query';
var link = ' href="/search?q=$oldtext" title="$oldtext" ';
link.replace("$oldtext", newText);
That would replace all instances of '$oldtext' with the string stored in newText.
Kyle
Upvotes: 1