Regular Expression

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Deepa
Posts: 1
Joined: Wed Apr 01, 2009 4:38 am

Regular Expression

Post by Deepa »

I am a complete novice to Regex. Need help to achieve the below.
I have a file which has many lines as below 2 lines. From this i jus need to extract the time stamp and also the name following the pattern (.html?).
There may be instances when a line may have more than one instance of the pattern .html?. But i need to extract the name only once from each line.
Can someone help.

12.10.219.39 - msundbole330 [10/Mar/2009:12:53:51 -0500] "GET /landing.html?Jenifer%20Holly HTTP/1.0" 200 5983 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"
12.10.219.39 - msundbole330 [10/Mar/2009:12:53:51 -0500] "GET /images/lock.jpg HTTP/1.0" 304 0 "http://xxxxxx-xxxxxxs.xxxxxxx.com/ccccc.html?Jenifer Holly" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"

Thanks.
Last edited by Deepa on Fri Apr 03, 2009 5:41 am, edited 1 time in total.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

What exactly do you want to do with the text you extract?
Which instance of .html? should be chosen if there's more than one of them?
How much text after .html? should be extracted? Everything up to the next "?
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Some other questions also....

1. When you get the time stamp do you also need the meridian offset (-0500 for example)?

2. Do you need the time adjusted by the offset to be local time?
Hope this was helpful.............good luck,
Bob
Post Reply