Using regexp with array->findposition

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using regexp with array->findposition

Anibal Escobar
Hi, this is on L8.5.  Is it possible to use a reqexp parameter to find  
the position of a match in an array?  For example, I have  
array('garden','garden.'), I'd like the regexp garden[\W]* to find  
both and then get their position in the array.

Thanks,
Anibal Escobar
646 336 5000 x8821


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Using regexp with array->findposition

fletcher sandbeck-2
On Oct 29, 2013, at 3:42 PM, Anibal Escobar <[hidden email]> wrote:

> Hi, this is on L8.5.  Is it possible to use a reqexp parameter to find the position of a match in an array?  For example, I have array('garden','garden.'), I'd like the regexp garden[\W]* to find both and then get their position in the array.

You can use [Match_Regexp] for that.

This will return the matched elements:

array('garden','garden.','other')->find(match_regexp('garden\\W*'));

This will return the positions of the matched elements:

array('garden','garden.','other')->findposition(match_regexp('garden\\W*'));

Hope this helps,

[fletcher][


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>