Created
September 9, 2025 14:52
-
-
Save seemly/9f232b116e38283132ba22534c9ffac2 to your computer and use it in GitHub Desktop.
This is a formula snippet for Google Sheets to prepare the From column in WP Engine regex URL redirects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*========================== | |
| 1.) Google Sheets spreadsheet should have a sheet named 'source' and a another called 'target'. | |
| 2.) 'source' sheet should contain raw/unprocessed export of 'From' and 'To' columns. Therefore, column selectors may need updating. | |
| 3.) Copy and paste each of the formulas below as appropriate into your 'target' sheet. | |
| ==========================*/ | |
| /*. From column */ | |
| =ARRAYFORMULA( | |
| IF(LEN(source!A2:A), | |
| IF(REGEXMATCH(source!A2:A, "\.[a-zA-Z0-9]+$"), | |
| "^" & REGEXEXTRACT(source!A2:A, "https?://[^/]+(/.*)"), | |
| "^" & REGEXREPLACE(REGEXEXTRACT(source!A2:A, "https?://[^/]+(/.*)"), "/$", "") & "/?$" | |
| ), | |
| ) | |
| ) | |
| /*. To column */ | |
| =ARRAYFORMULA(IF(LEN(source!B2:B), source!B2:B, )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment