Jump to content

Recommended Posts

Posted

No it's not. 

It is essentially the same as

Stringregexp($data, '\b\Q' & $Password & '\E\b')

as suggested earlier.

The OP's problem was not making the match restrictive enough.

kylomas

I understand! That is the part I was missing (not restrictive enough). Thank you everyone! Both examples worked!

Posted

the text file contains

_password_
siteip-192.168.10.105
unl

I ended up putting underscores on both sides of the password and then used the following code

$chckpass = StringInStr($datafile, "_" & $password & "_")
        If $chckpass > 0 Then

I used a ">" in the "If" statement because the StringInStr will return a number greater than 0 if there is a match. This seems to be working for me. Should I be aware of any problems this route may cause? Oh I didn't try case sensitive.
 

  • Moderators
Posted (edited)

StringRegExp($datafile, "(?m)^Q" & $password & "E$")

 

Edit:

An ini file makes much more sense here after seeing the above file format.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • Solution
Posted

the text file contains

_password_

siteip-192.168.10.105

unl

I ended up putting underscores on both sides of the password and then used the following code

$chckpass = StringInStr($datafile, "_" & $password & "_")
        If $chckpass > 0 Then

I used a ">" in the "If" statement because the StringInStr will return a number greater than 0 if there is a match. This seems to be working for me. Should I be aware of any problems this route may cause? Oh I didn't try case sensitive.

 

For the record, if the return is 0 it resolves to false. Anything else resolves to True.

So 

If $chckpass Then

Is perfectly acceptable.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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
×
×
  • Create New...