java - Pig: Regular Expression syntax -
i using string comparison using regular expression in pig script.
i know regular expression in pig same java.
the problem facing is: need remove character contain white space @ trailing end ?
my regular expression this: (name matches '!\\s+$')
sample script-----
raw_data = load '$input' using pigstorage(',') (fname:chararray); filter_data = filter raw_data (fname matches '!\\s+$'); dump filter_data;
sample input-----
abcd ,123 pqrs,234 xyz ,234 lmn,2345
it not writing on stdout
, should have written "pqrs"
, "lmn"
.
i don't know pig
, in java 1 syntactically-correct regex match pqrs,234
, lmn,2345
, be:
^\s+$
assuming in multiline
mode.
- in java escape backslashes, turns
^\\s+$
- in java can turn on
multiline
(?m)
regex(?m)^\\s+$
see demo.
Comments
Post a Comment