regex - Scala Regular Expression -
i having problem getting regular look right:
sample string looks this:
"li3001easdasfsaasfasdi5ei1409529297ei1409529597ed16:acl_dec_tag_listl15:default_case_11e18:avc_app_name_statsd29:generic search engine trafficd4:sizei5875e5:totali5ee16:odnoklassniki.rud4:sizei456e5:totali1ee7:unknownd4:sizei6391e5:totali2ee5:yahood4:sizei15673e5:totali1ee10:yahoo maild4:sizei5982e5:totali1e" i want string grouped this:
(li<digit 1-4>e <string of varying length> i<single digit>e) (<string2 of varying length>) this effort @ regex far: (li\d{1,}e.*i\de)(.*)
i first occurrence of li<digits 1-4>e well.
simple mistake. * greedy operator, meaning match much can , still allow remainder of regex match. utilize *? instead non-greedy match meaning "zero or more — preferably few possible".
(li\d{1,}e.*?i\de)(.*) regex scala
No comments:
Post a Comment