Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regex for number and period..Like version

 
auvrm papu
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

^ 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic