Regex help, please
Harvey Toyama
harvey.toyama at qlogic.com
Mon Oct 10 20:05:43 EDT 2005
Hi Dave,
That worked well. Thank you.
Since the log file is > 500,000 lines long your second bit of advice was
even more helpful. I can't estimate how many orders of magnitude faster
it is without a line count running.
-- Harvey
--
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Dave Cragg
Sent: Monday, October 10, 2005 4:27 PM
To: How to use Revolution
Subject: Re: Regex help, please
On 11 Oct 2005, at 00:04, Harvey Toyama wrote:
> Hi,
>
> I have a log file to parse. The data looks like this:
>
> Chip_Test:
>
> 2 1075.7 R120<-7000h 00020000 mov
> HifRegs
> 2 1088.1 R14<-7000h 00020002 mov
> HifRegs
> 6 1100.5 [7020h]<-1h 00020004 mov
> RSTS_Busy
>
>
> I do not want to capture the line with "Chip_Test:". I know the third
> character will always be a single digit number. I have a feeble
> knowledge of Regex from casual Unix use. I thought something like this
> would work
>
> put line vLineCounter into vLineBuffer
> if char 3 of vLineBuffer = "[0-9]" then
> ...
regEx in Rev is only used in the MatchText and ReplaceText functions.
You could do this:
if char 3 of vLineBuffer is a number then
But you're missing something in the first line. Assuming vLineCounter
is a number, and the data to parse is in a variable named vData, then
you need something like this:
put line vLineCounter of vData into vLineBuffer
If you're parsing through all the lines in the file, and if it's
long, you'll find that the expression "line vLineCounter of vData"
takes longer to evaluate as the value of vLineCounter gets higher. In
that case, the "repeat for each" format would be a lot faster.
Something like:
repeat for each line vLine in vData
if char 3 of vLine is a number then
-- your stuff
end if
end repeat
Cheers
Dave
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list