@@ -177,16 +177,6 @@ Feature: Do global search/replace
177
177
"""
178
178
world, Hello
179
179
"""
180
- When I run `wp search-replace 'o' 'O' --regex --regex-limit=1`
181
- Then STDOUT should contain:
182
- """
183
- wp_posts
184
- """
185
- When I run `wp post list --fields=post_title`
186
- Then STDOUT should contain:
187
- """
188
- wOrld, Hello
189
- """
190
180
191
181
Scenario : Regex search/replace with a incorrect `--regex-flags`
192
182
Given a WP install
@@ -200,16 +190,6 @@ Feature: Do global search/replace
200
190
kppr
201
191
"""
202
192
And the return code should be 1
203
- When I run `wp search-replace 'o' 'O' --regex --regex-limit=1`
204
- Then STDOUT should contain:
205
- """
206
- wp_posts
207
- """
208
- When I run `wp post list --fields=post_title`
209
- Then STDOUT should contain:
210
- """
211
- HellO world!
212
- """
213
193
214
194
Scenario : Search and replace within theme mods
215
195
Given a WP install
@@ -900,17 +880,6 @@ Feature: Do global search/replace
900
880
Content_ab\1z__baz_1234567890_eb\1z__bez_1234567890_ib\1z__biz_1234567890_ob\1z__boz_1234567890_ub\1z__buz_
901
881
"""
902
882
903
- When I run `wp search-replace '_{2}' '-' wp_posts --regex --regex-limit=2 --log --before_context=11 --after_context=11`
904
- Then STDOUT should contain:
905
- """
906
- Title_ab\1z-baz-ob\1z__boz_
907
- """
908
- When I run `wp post get {POST_ID} --field=title`
909
- Then STDOUT should be:
910
- """
911
- Title_ab\1z-baz-ob\1z__boz_
912
- """
913
-
914
883
Scenario : Logging with prefixes and custom colors
915
884
Given a WP install
916
885
@@ -1061,3 +1030,24 @@ Feature: Do global search/replace
1061
1030
"""
1062
1031
Success: 1 replacement to be made.
1063
1032
"""
1033
+
1034
+ Scenario : Regex search/replace with `--regex-limit=1` option
1035
+ Given a WP install
1036
+ And I run `wp post create --post_content="I have a pen, I have an apple. Pen, pine-apple, apple-pen." `
1037
+
1038
+ When I run `wp search-replace --regex "ap{2}le" "orange" --regex-limit=1 --log`
1039
+ Then STDOUT should contain:
1040
+ """
1041
+ I have a pen, I have an orange. Pen, pine-apple, apple-pen.
1042
+ """
1043
+
1044
+
1045
+ Scenario : Regex search/replace with `--regex-limit=2` option
1046
+ Given a WP install
1047
+ And I run `wp post create --post_content="I have a pen, I have an apple. Pen, pine-apple, apple-pen." `
1048
+
1049
+ When I run `wp search-replace --regex "ap{2}le" "orange" --regex-limit=2 --log`
1050
+ Then STDOUT should contain:
1051
+ """
1052
+ I have a pen, I have an orange. Pen, pine-orange, apple-pen.
1053
+ """
0 commit comments