in reply to regular expression help
Search first four comma or tab separated alpha numeric valuesimplying that your input might have mixed delimiters. If so, and if a given line is either comma-delimited or tab-delimited, then you need an alternation of the ikegami and Cristoforo regexes from above, like so:
If the two delimiters can be mixed on the same line, then:print grep / ^ (?: (?:[^,]*,){4},{3}\d,0,\d | (?:[^\t]*\t){4}\t{3}\d\t0\t\d ) /x, <DATA>;
print grep /^(?:[^,\t]*[,\t]){4}[,\t]{3}\d[,\t]0[,\t]\d/, <DATA>;
Updated:No need for capturing in the alternation.
|
|---|