Skip to content

Commit 7664195

Browse files
committed
remove check by incorrect regex
1 parent 2aaed78 commit 7664195

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

features/db-search.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,10 @@ Feature: Search through the database
702702
Then STDOUT should be empty
703703

704704
When I try `wp db search 'unfindable' --regex --regex-flags='abcd'`
705+
Then STDERR should be:
706+
"""
707+
Error: The regex '/unfindable/abcd' fails.
708+
"""
705709
Then the return code should be 1
706710

707711
When I run `wp db search '[0-9é]+?https:' --regex --regex-flags=u --before_context=0 --after_context=0`

src/DB_Command.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,6 @@ public function search( $args, $assoc_args ) {
820820

821821
if ( ( $regex = \WP_CLI\Utils\get_flag_value( $assoc_args, 'regex', false ) ) ) {
822822
$regex_flags = \WP_CLI\Utils\get_flag_value( $assoc_args, 'regex-flags', false );
823-
// http://php.net/manual/en/reference.pcre.pattern.modifiers.php
824-
if ( $regex_flags && ! preg_match( '/^(?!.*(.).*\1)[imsxeADSUXJu]+$/', $regex_flags ) ) {
825-
WP_CLI::error( "Incorrect PCRE modifiers." );
826-
}
827823
$regex_delimiter = \WP_CLI\Utils\get_flag_value( $assoc_args, 'regex-delimiter', '/' );
828824
if ( '' === $regex_delimiter ) {
829825
$regex_delimiter = '/';

0 commit comments

Comments
 (0)