Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Parsing out a 9-digit number from given string

Thread Tools

Parsing out a 9-digit number from given string

Posts: n/a

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));

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,

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing out a 9-digit number from given string daniel_of_vienna Javascript 1 05-05-2009 02:57 PM
" Given BACK what was freely GIVEN " C++ 0 12-13-2006 02:56 AM
Days in a given date range for a given month......... Lord0 Java 1 04-19-2006 04:54 PM
generate all possible strings of given length given a set of characters chiara C Programming 6 10-06-2005 01:43 AM
Parsing a date from the week number of a given year from request post J. Muenchbourg ASP General 0 08-08-2003 11:33 PM