Jump to content

StringRegExp


Recommended Posts

hello all,

I try to understand why I do have a trouve with StringRegExp...

I want to find "b" in $MyString and split $MySearch in 3 groups (bebore "b", "b", after "b").

$MyArray is always empty but, for my point of view, the search is correct. I have used "Regexcoach" ti check if there's a mistake but RegexCoach (which i a nice software) tells me I am right.

When I read the AutoIT Help, I understand that StringRegExp must returns an array with AAAA , b , CCCC.

$MyString = "AAAAbCCCC"

$MySearch = "(^\w+)( b )(\w+$)"

$MyArray = StringRegExp( $MyString , $MySearch , 3)

Well, if someone has an idea...

Thanks,

Remark : there is no Spaces in $Mysearch but I needed to put some because, without, a beautifull smiley appears.

Francis B)

Edited by Francis Lennert (France)
Link to comment
Share on other sites

I have been playing around. I do not know if this will help

$MyString = "AAAAbCCCC"
$MySearch = "(\w+)(b)(\w+)"

$MyArray = StringRegExp( $MyString , $MySearch , 3)
MsgBox(0,"",$MyArray[0])
MsgBox(0,"",$MyArray[1])
MsgBox(0,"",$MyArray[2])
Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

I have been playing around. I do not know if this will help

$MyString = "AAAAbCCCC"
$MySearch = "(\w+)(b)(\w+)"

$MyArray = StringRegExp( $MyString , $MySearch , 3)
MsgBox(0,"",$MyArray[0])
MsgBox(0,"",$MyArray[1])
MsgBox(0,"",$MyArray[2])
I helps me really. Many thanks,

But I don't understanf why the "Begin With" (^) and the "End With" ($) don't work in my search

because It does begin with a char and ends with a char too.

Do you have any idea ????

Francis

Edited by Francis Lennert (France)
Link to comment
Share on other sites

I helps me really. Many thanks,

But I don't understanf why the "Begin With" (^) and the "End With" ($) don't work in my search

because It does begin with a char and ends with a char too.

Do you have any idea ????

Francis

$MyString = "AAAAbCCCC"

$MySearch = "^(\w+)( b )(\w+)$"

I am sure taht my mistake was to include the "^" and "$" in the ().

This $MySearch works and is almost the same at my first one.

But you're right, there is no differences with your Search which is more simple.

Thanks,

Edited by Francis Lennert (France)
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...