Parsing out a 9-digit number from given string

  • Thread starter daniel_of_vienna
  • Start date
D

daniel_of_vienna

Hello,

thisi s my first (okay 2nd) try with JavaScript.
I have the following issue:
I've made a MenuExt for Internet Explorer wich calls a .js. This gets
the "external.menuArguments.event.srcElement.innerHTML" of the user is
hovering with the Mouse.
in the next step I put this to the Clipboard.

The working code:

<script type="text/javascript">
var str = external.menuArguments.event.srcElement.innerHTML;
window.clipboardData.setData ("Text", (str));
</script>

The Challenge (at least for me... :)):

in this string somewhere is a 9-digit number, and exactly this I
needed on the Clipboard.....
I've read about RegExp and I guess this shall work:

var srch = /\d {9}/g;
var str2 = srch.exec(str);

But since this is not a String output, I cannot put it to the
Clipboard.... (I think so...)

Could someone please help?

Thanks in advance,
Daniel
 
S

SlipKnob

Haha! This is a classic case of "If you want to get an answer from a
group, then politely ask like a sincere novice who's trying hard."

Like being cute or sexy, it gets results like magic.

-George Hernandez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top