473,473 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

quick regex question

Anyone know how to match something wrapped using perl-style regular
expressions?

e.g. given "function(input, input2, etc)"

How can you match just the inputs? $re = "/function\([^\)]*\)/"; will
match the entire string, but I'd prefer to just
get back the inputs.

Any advice would be greatly appreciated.

Thanks!
Keith
Sep 27 '08 #1
1 1115
On Sat, 27 Sep 2008 05:11:08 -0700 (PDT), Keith Hughitt
<ke***********@gmail.comwrote:
>Anyone know how to match something wrapped using perl-style regular
expressions?

e.g. given "function(input, input2, etc)"

How can you match just the inputs? $re = "/function\([^\)]*\)/"; will
match the entire string, but I'd prefer to just
get back the inputs.

Any advice would be greatly appreciated.
$test = "function(input, input2, etc)";

if ( preg_match("/function\(([^\)]*)\)/", $test, $match) )
{
$inputs = preg_split("/[\,\s]+/", $match[1]);
print_r($inputs);
}
Sep 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: K. Shier | last post by:
while writing a RegEx, you implicily name your Groups: \b(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{2,4})\b so, why isn't .Name a property of a System.Text.RegularExpressions.RegEx.Group? ...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
5
by: Troy | last post by:
Hello, I'd like to validate an input my from user i.e. make sure that the user enters the phone number is the following formats (XXX) XXX-XXXX XXX-XXX-XXXX Any ideas on how I can achieve...
7
by: Extremest | last post by:
I am using this regex. static Regex paranthesis = new Regex("(\\d*/\\d*)", RegexOptions.IgnoreCase); it should find everything between parenthesis that have some numbers onyl then a forward...
10
by: yoni | last post by:
Hey, i am trying to get to the right regexp to remove everything that's a multi line comment. in other words, everything between \*...*/. my expression is: /\*.*\*/ Doesnt work... Anybody...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.