Search array by a regex

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Search array by a regex

Post by klevis miho »

How can I search an array for a regular expression, and get the array keys for the match?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Search array by a regex

Post by pickle »

I think you'd have to iterate through the array, doing a regex compare on each value.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Search array by a regex

Post by klevis miho »

yeah, thats what i did :) , thnx
Post Reply