in reply to Re^3: Passing a regex from a CGI HTML form [EXAMPLE DATA]
in thread Passing a regex from a CGI HTML form

Are those full lines? I mean, is this a situation where you can just grab the first and last non-whitespace chars, and just not bother with the stuff in between? ie. does the below code work in your cases, or are there other things that need consideration?

use warnings; use strict; while (<DATA>){ if (/^(\w+).*\s(\w+)/){ my $line = "$1,$2"; print "$line\n"; } } __DATA__ SWA vs CHE GK WBA @ BOU GK EVE GK EVE 4 87 dwqer *** GK

Output:

SWA,GK WBA,GK EVE,GK EVE,GK

Replies are listed 'Best First'.
Re^5: Passing a regex from a CGI HTML form [EXAMPLE DATA]
by Linicks (Scribe) on Aug 31, 2016 at 20:04 UTC

    "Are those full lines?"

    I wish, that is one little line... in that format - there are between 5 to 10 for each player that changes randomly, and remember, the data copied 'n' pasted changes quiet a lot on the fly depending on games/injuries/banned/transfers- that is the issue. So I need a way to get new subsititions in for a temporary measure until I can re-code the code when I get home.

    Nick