From f776b3067504d4b36a177cfec2ff2a3fc2421b33 Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Tue, 24 Oct 2023 15:58:29 +0200 Subject: [PATCH] regexp fix --- .github/workflows/wpt-test.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wpt-test.yml b/.github/workflows/wpt-test.yml index d7e586ec..051f419c 100644 --- a/.github/workflows/wpt-test.yml +++ b/.github/workflows/wpt-test.yml @@ -63,14 +63,11 @@ jobs: if [ $start_index -gt -1 ]; then # Initialize an array for URLs declare -a URLS - url_pattern="^(http|https|ftp)://[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,4})(/[a-zA-Z0-9_.-]+)*(\/?)(\?[a-zA-Z0-9_.-]+=[a-zA-Z0-9%_.-]+)*$" + url_pattern="((http|https|ftp):\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,4})(\/[a-zA-Z0-9_.-]+)*(\/?)(\?[a-zA-Z0-9_.-]+=[a-zA-Z0-9%_.-]+)*(\#?)([a-zA-Z0-9%_.-=]+)*)" for ((i=start_index; i<${#lines[@]}; i++)); do - url="${lines[$i]}" - # Remove any extra characters or spaces - url="${url//[- ]/}" - if [[ $url =~ $url_pattern ]]; then - URLS+=("$url") + if [[ ${lines[$i]} =~ $url_pattern ]]; then + URLS+=("${BASH_REMATCH[1]}") fi done