ryantollefson

Help with StringRegExp

3 posts in this topic

I'm trying to find the last decimal number from a text file.  Problem is that the array that is returned will return multiple values, but only from the first line in which they occur, not from additional lines in the file.

$tmpTxt = "tmptxt.txt"
$aFile = FileOpen($tmpTxt)
$file = FileRead($aFile)
$regex = StringRegExp($file,'([0-9]{1,5}\.[0-9]{2})(.*)', 1)

Thanks for any help you can provide.

Share this post


Link to post
Share on other sites



Never mind... guess I just needed to post a stupid question publicly and the answer would come to me.

$regex = StringRegExp($file,'([0-9]{1,5}\.[0-9]{2})', 3)

Wrong flag for StringRegExp.

Share this post


Link to post
Share on other sites

Sometimes it just helps to put write your problems down and the answer will present itself in the process or shortly after, as you demonstrated here. :) Please mark it as solved with your second post as no doubt someone else would have this problem in the future and your post could help them solve it!

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