find all matches awk

function FindAllMatches(str, regex, match_arr) { m = 0; ini = RSTART; leng = RLENGTH; delete match_arr; while (match(str, regex) > 0) { match_arr[++m] = substr(str, RSTART, RLENGTH) str = substr(str, RSTART+RLENGTH) gsub(/[\(\)]/, "", match_arr[m]); } m > 0 ? encontrado = 1 : encontrado = 0; RSTART = ini; RLENGTH = leng; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.