Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > Perl
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Perl section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 31st, 2009, 11:27 PM
Authorized User
Join Date: Nov 2007
Location: , , .
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Question Regular Expression Error


I'm trying to split a line if it's match with my pattern.
I would like to get [user:myuser][filename:test.txt][status:pending][here something else] from a line.

eg. $line is
[localhost 2009/09/01 12:34:02] ME INFO: [user:myuser][filename:test.txt][status:pending][here something else]
if($line =~ /.*(\[.*\]{3,}).*/)
   print $line;
My regex doesn't match with my line.
Can someone tell me what's wrong with my regular expression.

Reply With Quote
  #2 (permalink)  
Old September 6th, 2009, 01:05 PM
Authorized User
Points: 93, Level: 1
Points: 93, Level: 1 Points: 93, Level: 1 Points: 93, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2009
Location: Moldova
Posts: 23
Thanks: 0
Thanked 2 Times in 2 Posts

Of course it wouldn't match - you don't have ']]]' in your string.

use /((?:\[.*\]){3,})/
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
regular expression MunishBhatia ASP.NET 2.0 Professional 5 May 22nd, 2007 07:59 AM
Unknown Modifier Error - Regular Expression Beebs BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 March 20th, 2007 05:48 PM
Regular Expression Error kwilliams ASP.NET 1.0 and 1.1 Basics 3 February 16th, 2006 04:49 PM
regular expression Moharo Pro PHP 3 April 30th, 2004 04:44 AM
help in regular expression diby Beginning PHP 1 September 17th, 2003 12:25 PM

All times are GMT -4. The time now is 09:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.