android - java find price value in string -
i want find price value in string(incoming sms message). using java regex:
pattern pattern = pattern.compile("\\d+.\\d\\d");/
but expression find date too. example 12.12.2013
returns 12.12
. if there way find price value? maybe not using regex, because string isn't long.
edited example of message:
oplata tovariv: s1lv0gru rykavuchka 510, ua 02.04.2013 21:12 kartka 1111111111 na sumu 24.72uah. dostupnyi zalyshok 1351.58uah.
if general format of prices xxxx.xx, can use:
"(?<!(?:\\d|\\.))\\d+\\.\\d{2}(?!\\.)"
at least wouldn't match dates.
(don't forget escape point it's not wildcard)
Comments
Post a Comment