[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Perl Regular Expression?

Posted on 2011-05-12
2
Medium Priority
?
260 Views
Last Modified: 2012-05-11
So I have a string that is always contains general. and is following by some text and number. I need a regular expression to remove the general. and only leave anything after the period.
$before = general.XXXXX
Some regular expression that will remove general.
$after = XXXXX

Open in new window

0
Comment
Question by:KGNickl
  • 2
2 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 35751386
$before = 'general.XXXXX';

$before =~ m/general\.(.*)/;

$after = $1;
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35751483
This would also work


my $before = 'general.XXXXX';
my ($after) = $before  =~ m/general\.(.*)/;

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  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…
Six Sigma Control Plans
Suggested Courses

834 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