Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-28-2005, 11:47 AM   PM User | #1
looka
Regular Coder

 
Join Date: Aug 2004
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
looka is an unknown quantity at this point
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
looka is offline   Reply With Quote
Old 05-28-2005, 03:19 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
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..
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 05:40 AM.


Advertisement
Log in to turn off these ads.