Jump to content
UBot Underground

Quick Javascript string question


Recommended Posts

I created a ubot that scrapes keywords out of the latest Google keyword tool. Sometimes a scraped word will be in bold and I want to get rid of the <B> and </B> tags with one javascript .replace expression. Right now I'm doing it with two:

 

http://img62.imageshack.us/img62/9205/strip.png

 

It works, but how do I simplify it so I have the eval only running once. I'm sure you can do it, I just don't know the syntax to combine two choices.

 

Something like this?

 

'{1}'.replace(/<B>+<.B>/, '');

Link to post
Share on other sites

I think you are okay. Jamming it into one node will not gain you much. AFterall, you're splitting hairs at that point.

 

I use $replace instead of the javascript. Not that it matters but its another available path.

Link to post
Share on other sites

Can you replace BOTH <B> and </B> at the same time? Or do you have to do two passes at it? I don't have that many hairs left (on my head) at this point. :-)

Link to post
Share on other sites

Can you replace BOTH <B> and </B> at the same time? Or do you have to do two passes at it? I don't have that many hairs left (on my head) at this point. :-)

 

Yes you can just nest the replace function in one another , and bingo.. ;)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...