Parsing out a 9-digit number from given string

Discussion in 'Javascript' started by daniel_of_vienna, May 4, 2009.

  1. 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
     
    daniel_of_vienna, May 4, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fangs
    Replies:
    3
    Views:
    9,839
    darshana
    Oct 26, 2008
  2. Steven
    Replies:
    8
    Views:
    476
    Arndt Jonasson
    Feb 3, 2006
  3. Alessio
    Replies:
    10
    Views:
    709
    Alessio
    Oct 5, 2009
  4. J. Muenchbourg
    Replies:
    0
    Views:
    155
    J. Muenchbourg
    Aug 9, 2003
  5. daniel_of_vienna

    Parsing out a 9-digit number from given string

    daniel_of_vienna, May 4, 2009, in forum: Javascript
    Replies:
    1
    Views:
    113
    SlipKnob
    May 5, 2009
Loading...

Share This Page