Jump to content

StringRegExp


strate
 Share

Recommended Posts

I've been trying to get the mentioned function to work and cannot. The search string can be formatted as follows though not always

3, 35

45, 56

23, 9

Two spaces are between "," and the next digit or set of digits.

I have never used this function and can't seem to get it to work. :)

$string = inputbox('test','test string: ')
If StringRegExp($string,'[:DIGIT:][,][:DIGIT:]') = 1 Then
     MsgBox(4096,'Mem Scan','Memory Scan Complete!',(1000*60)*10)
     Exit
EndIf
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

  • Moderators

I've been trying to get the mentioned function to work and cannot. The search string can be formatted as follows though not always

3, 35

45, 56

23, 9

Two spaces are between "," and the next digit or set of digits.

I have never used this function and can't seem to get it to work. :)

$string = inputbox('test','test string: ')
If StringRegExp($string,'[:DIGIT:][,][:DIGIT:]') = 1 Then
     MsgBox(4096,'Mem Scan','Memory Scan Complete!',(1000*60)*10)
     Exit
EndIfoÝ÷ Ûú®¢×«^ŧ-&«{*.¶¼¢hv±¶¶¶Ø^éz»(®Çø­ßÛ-êâ_¢¹µ«­¢+ØÀÌØíÍÑÉ¥¹ô¥¹ÁÕѽà ÌäíÑÍÐÌäì°ÌäíÑÍÐÍÑÉ¥¹èÌäì¤)%MÑÉ¥¹IáÀ ÀÌØíÍÑÉ¥¹°ÌäìÀäÈí¬°ÀäÈí¬Ìäì¤ôÄQ¡¸(5Í  ½à ÐÀäØ°Ìäí5´M¸Ìäì°Ìäí5µ½ÉäM¸
½µÁ±ÑÌÌìÌäì° ÄÀÀÀ¨ØÀ¤¨ÄÀ¤(á¥Ð)¹%

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.

Link to comment
Share on other sites

What exactly are you trying to do... extract the numbers or see if it's the right format?

$string = inputbox('test','test string: ')
If StringRegExp($string,'\d+,\d+') = 1 Then
     MsgBox(4096,'Mem Scan','Memory Scan Complete!',(1000*60)*10)
     Exit
EndIf
I'm trying to find the right format. Will your example also catch the spaces?

Edit: Nevermind It doesn't.

Edit2: Thanks, it will head me in the right direction.

Edit3: I just added a couple spaces to the "match" string. Would that be the proper way?

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

  • Moderators

I'm trying to find the right format. Will your example also catch the spaces?

What do you mean "catch" them? Are they allowed?

StringRegExp($string,'\s*\d+\s*,\s*\d+\s*')
should allow spaces.

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.

Link to comment
Share on other sites

Thank you very much, I think that after looking at the help file and comparing it to what you had gave, I've figured the function out. The examples it (the help file) made it harded.

'\s*\d+,\s*\d+'

Was the final pattern that matches perfectly.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
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...