perll, how to extract word in paren using regex

Posted on 2011-10-23
Last Modified: 2012-05-12
# I have data is this format, how to extract first name and last name
$fullName = "lastname(firstname)";
$fullName = "jones-smith(billy-bob)";

#How to regex to get $1 and $2 as last name and first name?
Question by:rgbcof
    LVL 84

    Accepted Solution

    $fullName =~ /(.*)\((.*)\)/;

    Author Closing Comment

    You solved it.  Thanks.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Perl Sort Question 4 108
    PERL variable conundrum 9 75
    Perl Awk Need Help 3 85
    PERL - Find newest folder 12 87
    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now