Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Regex for number and period..Like version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regex for number and period..Like version" Watch "Regex for number and period..Like version" New topic
Author

Regex for number and period..Like version

auvrm papu
Ranch Hand

Joined: Sep 01, 2005
Posts: 105
regex to allow numbers and period ( like versions 1.45.45)

for ex:

456.5466.445.566.45656.5656..

something like this

Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923


^ negates a group - not what you want.
[.] inside a group isn't meaningful, if dot is threatened as a wildcard.
So no escaping needed inside the grouping.
+ at least one occurence (which would allow a single ".").
A leading dot is allowed too: .9.19

To prohibit a leading dot:

This eliminates a single dot too, because a single dot is essential a leading dot.


http://home.arcor.de/hirnstrom/bewerbung
 
jQuery in Action, 2nd edition
 
subject: Regex for number and period..Like version
 
Similar Threads
Regex - is there like a NOT statement (like ! in java)?
Regular Expresion
Regex - match group that contains word AND does not contain another word
Regex question
how to retrive something from a line of string