ExtractRegularExpression + Structured Arrays

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
!ns0
New User
New User
Posts: 4
Joined: Wed Feb 20, 2013 10:07 am

ExtractRegularExpression + Structured Arrays

Post by !ns0 »

:( I'm very unhappy with that ExtractRegularExpression function can't write results to Structured Array.

It will be very nice if something like this will be implemented:

Code: Select all

ExtractRegularExpression(0, string$, Array()\Structure1)
▌│█║▌║▌ █║║▌║█
buddymatkona
Enthusiast
Enthusiast
Posts: 252
Joined: Mon Aug 16, 2010 4:29 am

Re: ExtractRegularExpression + Structured Arrays

Post by buddymatkona »

Is 5.11 code like this is no longer allowed in 5.12? If so, then +1. A safe alternative might be to limit results to space available within structures.

Code: Select all

Structure MyStruct
  Array  MyArray.s(100)
EndStructure

Define MS.MyStruct
subject.s = " addonaddedaddition add readd added addadd "
pattern.s = "\w*add\b"
id.i = CreateRegularExpression(#PB_Any, pattern)

  If id
    NbFound = ExtractRegularExpression(id, subject, MS\MyArray())
    For k = 0 To NbFound-1 : Debug MS\MyArray(k) :Next
  Else
    Debug RegularExpressionError() : End
  EndIf
Post Reply