Jump to content

stringregexp and an exception


gcue
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...