Java regular expressions / regex -
i have following string:
$500 has been received username [rank].
i use following regex statement attempt amount paid (500) , username.
"^\\$(\\d+\\.?\\d*) has been received ([^.]+)\\.$"
unfortunately extracting this:
"username [rank]"
i have attempted modify instead of reading until '.' username variable read ' ', multiple back-slashes seem confusing me , unexpected results.
what regex 'code' need use extract balance , username? (the rank of no use me).
many thanks!
is kind of homework? reason ask this:
anyway - according site:
http://www.regexplanet.com/advanced/java/index.html
this shall work:
^\$(\d+\.?\d*) has been received (.*)\s\[(.*)\].$
Comments
Post a Comment