Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
regex javascript vs java?
I used an online regex generator to get /\\d*?\\.?\\d*/g
but its a generator for javascript
i need the equivalent for java
help!
thanks!
leo d
as far as i can tell the g means keep matching even if found already
i could be wrong but i dont think it's equivalent to java. i think this because it's not working!
thanks in advance though!
2 Answers
- Leo DLv 67 years agoFavorite Answer
If this part "\\d*?\\.?\\d*" means "zero or more reluctantly from [0-9], followed by an optional full stop, followed by zero or more greedily from [0-9]", then it's the same. I remember regular expressions being surrounded by forward slashes in Javascript, but I don't know what the gee after the expression means. I will check that out and get back to you.
Edit: I understand that the gee flag at the end means that it's a global search. I believe that in Java, that's unnecessary and instead this is done through methods of the Pattern class or the matcher class. Check out the API for those two classes.
- ?Lv 77 years ago
I didn't think javascript actually supported \d or \s or any of that nice fancy stuff, it's real bare-metal basics according to the spec. how about a tutorial?
http://docs.oracle.com/javase/tutorial/essential/r...
I googled java regex and found 2 nice links.