Jump to content
Sign in to follow this  
gcue

stringregexp and an exception

Recommended Posts

gcue

this line picks out the line that has "full name: blah,blah" in a text file

then creates an array for the name

$var=StringRegExp($string, "(?:Full Name.\s+)(.*),.(.*)\r\n", 3)
If IsArray($dname) Then
        For $x = 0 To UBound($dname) - 1
            ConsoleWrite($dname[$x] & @CRLF)
        Next
endif

sometimes "blah,blah" is not seperated by a comma, how can i account account for both cases?

Edited by gcue

Share this post


Link to post
Share on other sites
Pain

I guess you are looking for "|" also know as OR.

or use [ ... ] (Match any character in the set)

Edited by Pain

Share this post


Link to post
Share on other sites
PsaltyDS

this line picks out the line that has "full name: blah,blah" in a text file

then creates an array for the name

$var=StringRegExp($string, "(?:Full Name.\s+)(.*),.(.*)\r\n", 3)
If IsArray($dname) Then
        For $x = 0 To UBound($dname) - 1
            ConsoleWrite($dname[$x] & @CRLF)
        Next
endif

sometimes "blah,blah" is not seperated by a comma, how can i account account for both cases?

If no comma, then what would be there? StringRegExp() is no psychic and you will have to specify what you want.

Where you have ",." there could be an alternate pattern like ",|\s" which would match either a comma or a single space.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.