Jump to content

Recommended Posts

Posted (edited)

Hi guys,

Here's some code:

#Include <Array.au3>

Local $TestCase1 = '    This line starts with some spaces'
Local $TestCase2 = 'This line starts with no spaces'

Local $RegExp = '^(\s*)(\w+)'
Local $Results1 = StringRegExp($TestCase1, $RegExp, 1)
Local $Results2 = StringRegExp($TestCase2, $RegExp, 1)

_ArrayDisplay($Results1, '$Results1')
_ArrayDisplay($Results2, '$Results2')

Here's the output I expect:

[0] = (some spaces)

[1] = This

[0] = (empty element)

[1] = This

Here's what I'm receiving:

[0] = (some spaces)

[1] = This

[0] = This

If StringRegExp() is asked to 'return an array with the text that matched all the group patterns' (i.e. flag 1) then is it fair to expect that the returned array contain as many elements as there are groups? With the current behaviour it is not possible to determine which element matches which group if not all groups return data. Edited by LxP
Posted

Hi!

There are several problems with StringRegExp(). Have a look at the bugs forum and make sure to use the latest beta.

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Posted

I had a quick look at the open StringRegExpReplace()-related bugs and if this could be classified as a bug then I think it would be a new one.

I'm not sure if it is regarded as buggy behaviour though, so I thought I should post here first.

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...