in reply to Re^3: Regex help
in thread Regex help

Thanks this was really helpful, you pretty much did all the work for me. I am trying to understand your regex expression which will take a bit. One more questions, is there no way to record the "# Record" column cells as being blank?

Replies are listed 'Best First'.
Re^5: Regex help
by kennethk (Abbot) on Jun 22, 2012 at 13:09 UTC

    Recording the "# Record" column cells as being blank is easy; the hard part would be changing the expression to record non-blank entries. You could just add an empty pair of parentheses, a la /^\s*(\S+)\s+(\S+)\s*()$/. Given that none of the lines contain three non-space blocks, you might even say /^\s*(\S+)\s+(\S+)\s*(\S*)\s*$/. Keep in mind that given these are such general expressions, it is absolutely essential that you test this against real input and be skeptical of the results.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.