PHP » PYTHON |
login |
register |
about
|
PYTHON preg_grep
is this article helpful?
|
Python replacement for PHP's preg_grep
[
edit
| history
]
import re lines = filter(lambda x: re.findall(u'SomeRegExp', x), lines) preg_grep(PHP 4, PHP 5) preg_grep — Return array entries that match the pattern Description
array preg_grep
( string $pattern
, array $input
[, int $flags= 0
] )
Returns the array consisting of the elements of the input array that match the given pattern . Parameters
Return ValuesReturns an array indexed using the keys from the input array. Changelog
Examples
Example #1 preg_grep() example
<?php
|
more
Recently updated
more
Most requested
more
Last requests
|