Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Regular Expressions
BOOK: Beginning Regular Expressions
This is the forum to discuss the Wrox book Beginning Regular Expressions by Andrew Watt; ISBN: 9780764574894
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Regular Expressions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 10th, 2007, 05:43 AM
Registered User
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to crazymanju
Default Help extracting text from a regular expression

I am new to regular expression i am trying to write a regular expression so that i can extract text from a line .This is one of the sample line "2007-01-10 16:42:06,646 DEBUG 2216 Symcon.Utils.MessageLogger.Logger - WRITE ERROR IN Range Name: __INPUT.Sample_MasterItem1.R37.I.S2.M1.81918e77_d7 32_48da_8634_849d2eb2fa27"
I have written a regular expression for this as

"(?<DateTime>((?:\d{4}|\d{2}))-(\d{1,2})-(\d{1,2})\s(\d{1,2}):(\d{1,2}):(\d{1,2})),(?<code> \d{3})\s(?<type>[A-Z]{5})\s(?<errornum>\d{4})\s(?<LogName>^[a-zA-Z.]+$)(?<ErrorMsg>[A-Za-z:\b])(?<RangeName>[a-zA-Z\d\.__])"

the text retrieved from the groups are as follows

<DateTime> = "2007-01-10 16:42:06"
<code> ="646"
<type> = "DEBUG"

I want the <LogName> to have the complete string "Symcon.Utils.MessageLogger.Logger" instead of "S" and <ErrorMsg> = WRITE ERROR IN Range Name: and <RangeName> = __INPUT.Sample_MasterItem1.R37.I.S2.M1.81918e77_d7 32_48da_8634_849d2eb2fa27

I have been trying to solve this for quite some time :( .Can any one please help me with this issue

Thanks in advance


Similar Threads
Thread Thread Starter Forum Replies Last Post
What will be the regular expression for following? amit_mande@yahoo.com ASP.NET 1.0 and 1.1 Basics 2 December 26th, 2006 06:49 AM
need regular expression keyvanjan ASP.NET 1.0 and 1.1 Basics 5 August 31st, 2006 07:16 AM
regular expression Moharo Pro PHP 3 April 30th, 2004 04:44 AM
Regular Expression Help Hadware .NET Web Services 3 November 4th, 2003 10:51 AM
help in regular expression diby Beginning PHP 1 September 17th, 2003 12:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.