Jump to content
Sign in to follow this  
Francis Lennert (France)

StringRegExp

Recommended Posts

Francis Lennert (France)

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)

Share this post


Link to post
Share on other sites
BigDod

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


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites
Francis Lennert (France)

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)

Share this post


Link to post
Share on other sites
Francis Lennert (France)

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)

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.