Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using 'intro' in RegExp

    hi, is possible to create a regular expression, who will match entire, but return only a part of a string given?

    mystring = 'yiha(whatever)';

    -i would like, i.e., only extract whatever is written in a between '(' and ')', but if followed with a word 'yiha'


    tnx

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can try working with this regular expression...

    Code:
    <script type="text/javascript">
     <!--//
      var mystring = 'yiha(whatever)';
       if(/yiha\((.*)\)/.test(mystring)){
          alert(RegExp.$1);
       }
     //-->
    </script>
    .....Willy
    Last edited by Willy Duitt; 05-28-2005 at 03:22 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •