Sign in to follow this  
Followers 0
440LVB

2 out of 3 of my regexp work ?!?

2 posts in this topic

Hello

I'm making a program where i need regexp. I use 3, but only 2 are actually working, while they're very similar...

This is the piece of code where the problem is :

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($fileRead)
    If @error = -1 Then 
        ExitLoop
    EndIf
    $energie = StringRegExp($line,'ISU;([GE]);',1)
    $readPDL = StringRegExp($line,'ISU;[GE];([0-9]{20});',1)
    $miseEnService = StringRegExp($line,';([0-9]{8})\n',1)
        
    If StringCompare($energie[0],"E") == 0 Then
        FileWriteLine($fileResultE,$readPDL[0] & ";" & $miseEnService[0])
    Else
        FileWriteLine($fileResultG,$readPDL[0] & ";" & $miseEnService[0])
    EndIf
Wend

It works well with $energie and $readPDL, but for $miseEnService, the compiler keeps telling me "Subscript used with non-Array variable" when I try to write the line.

Any idea why it works with the 2 other variables and not this one?

Thanks for help

Share this post


Link to post
Share on other sites



You should post an example of the $line variable so we know what it looks like. The 3rd regex statement clearly doesn't find a match in your line.

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