Solved

regex question

Posted on 2006-06-21
1
230 Views
Last Modified: 2010-03-05
Hi all i have a problem in the regular expression.. plz help

$a = "<a:1>\nb\nef\n</a>\n<a:2>\nb\n</a>\n<a:3>\nb\n</a>";

My problem is to remove <a:1>\nb\nef\n</a> from the string, facing problem in creating the non greedy regex for this. This cod contain n number of lines between <a:1> and </a>

Thanks


0
Comment
Question by:gourav_jain
1 Comment
 
LVL 10

Accepted Solution

by:
xanius earned 50 total points
Comment Utility
Hi!
$a =~ s/<a:1>.*?</a>//s;

replaces the first occuring <a:1< ... </a> from $a.

Xanius
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

12 Experts available now in Live!

Get 1:1 Help Now