Sign in to follow this  
Followers 0
wutzke

regexp check

3 posts in this topic

We have multi-page report with data to crunch

Each page is headed by

16-Oct, 06 16:04 Page 1/1252

(with each page show as ##/##)

The regexp I wrote is:

(0[1-9]|[12][0-9]|3[01])[- /.](\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\b)(\b(?:, )\b)([0-9]{2}[- /.])([0-9]{2}[: /.])([0-9]{2}[- /.])(\b(?:Page )\b)

What would you see as the best way to code that into a loop with $page holding the entire page text?

$headcheck = StringRegExp($page, $regexp, 3)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This pattern seemed to work:

$sString = "16-Oct, 06 16:04 Page 1/1252"
$sPattern = "(?s)(?i)\d{2}\-\w{3},\s+\d{2}\s+\d{2}\:\d{2}\s+Page\s+(\d+/\d+)"
$aArray = StringRegExp($sString, $sPattern, 3)
MsgBox(64, 'Info:', $aArray[0])oÝ÷ Ù«­¢+ØÀÌØíÁô¥±I ÌäíÑáйÑáÐÌäì¤
?

If it's all together after that, then you may look at breaking the pages up using the returned results from the above StringRegExp... Do /Count += 1/Until Line = $aArray[$num] or something.

Edit:

After running your SRE example, I may have been confused on what it was you were trying to return, see if this is more like it:

#include <array.au3>
$sString = "16-Oct, 06 16:04 Page 1/1252"
$sPattern = "(?s)(?i)(\d{2})\-(\w{3}),\s+(\d{2})\s+(\d{2})\:(\d{2})\s+(Page)\s+(\d+/\d+)"
$aArray = StringRegExp($sString, $sPattern, 3)
_ArrayDisplay($aArray, '')

Edit2:

Blah... Autoit code tags had a smiley face in the SRE pattern.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0