CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Problem extracting an expression 2: Edit Log



kepler
Novice

Jul 24, 2014, 3:52 AM


Views: 28767
Problem extracting an expression 2

Hi,

I'm having some troubles to extract an expresiion from a $line. The type of expression is, for example:

KP_what_I_want (space)
or
KP_what_I_want(
or
KP_what_I_want (
or
KP_what_I_want +
etc...

I'm using:


Code
my ($exp) =  
$line =~ m/
KP_ # Required
(.*) # Capture Desired Output
(?:\s)? # Optional - Do not capture
(?:\()? # Optional - Do not capture
/xi;


It's not working... it extracts the all expression ( without the KP_)

Any ideas?

Thanks,

Kepler


(This post was edited by kepler on Jul 24, 2014, 3:53 AM)


Edit Log:
Post edited by kepler (Novice) on Jul 24, 2014, 3:53 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives