@@ -195,13 +195,10 @@ Feature: Do global search/replace
195
195
Scenario : Regex search/replace with a incorrect `--regex-flags`
196
196
Given a WP install
197
197
When I try `wp search-replace '(Hello)\s (world)' '$2, $1' --regex --regex-flags='kppr' `
198
- Then STDERR should contain:
199
- """
200
- (Hello)\s(world)
201
- """
202
- And STDERR should contain:
198
+ Then STDERR should be:
203
199
"""
204
- kppr
200
+ Error: The regex pattern '(Hello)\s(world)' with default delimiter 'chr(1)' and flags 'kppr' fails.
201
+ preg_match(): Unknown modifier 'k'.
205
202
"""
206
203
And the return code should be 1
207
204
@@ -403,34 +400,39 @@ Feature: Do global search/replace
403
400
Then STDERR should be:
404
401
"""
405
402
Error: The regex '1HTTP://EXAMPLE.COM1i' fails.
403
+ preg_match(): Delimiter must not be alphanumeric or backslash.
406
404
"""
407
405
And the return code should be 1
408
406
409
407
When I try `wp search-replace 'regex error)' '' --regex`
410
408
Then STDERR should be:
411
409
"""
412
410
Error: The regex pattern 'regex error)' with default delimiter 'chr(1)' and no flags fails.
411
+ preg_match(): Compilation failed: unmatched parentheses at offset 11.
413
412
"""
414
413
And the return code should be 1
415
414
416
415
When I try `wp search-replace 'regex error)' '' --regex --regex-flags=u`
417
416
Then STDERR should be:
418
417
"""
419
418
Error: The regex pattern 'regex error)' with default delimiter 'chr(1)' and flags 'u' fails.
419
+ preg_match(): Compilation failed: unmatched parentheses at offset 11.
420
420
"""
421
421
And the return code should be 1
422
422
423
423
When I try `wp search-replace 'regex error)' '' --regex --regex-delimiter=/`
424
424
Then STDERR should be:
425
425
"""
426
426
Error: The regex '/regex error)/' fails.
427
+ preg_match(): Compilation failed: unmatched parentheses at offset 11.
427
428
"""
428
429
And the return code should be 1
429
430
430
431
When I try `wp search-replace 'regex error)' '' --regex --regex-delimiter=/ --regex-flags=u`
431
432
Then STDERR should be:
432
433
"""
433
434
Error: The regex '/regex error)/u' fails.
435
+ preg_match(): Compilation failed: unmatched parentheses at offset 11.
434
436
"""
435
437
And the return code should be 1
436
438
0 commit comments