Print Page | Close Window

Value Regex

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=862
Printed Date: 27.Mar.2026 at 02:14
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Value Regex
Posted By: Saivignesh
Subject: Value Regex
Date Posted: 01.May.2017 at 14:07
I want to enter values between [0-1]
If I give a restriction in value regex as [0-1] am not able to enter decimal values. 
How to I set my constraints to achieve it?
 



Replies:
Posted By: stevek
Date Posted: 01.May.2017 at 17:23
There are two approaches to making regular expressions:
  1. Learn regular expression syntax, e.g. from the http://www.metacase.com/support/55/manuals/mwb/Mw-Appendix.html" rel="nofollow - MetaEdit+ Workbench user guide Appendix A: Regular expressions
  2. Search the forums or Google for each one you want, e.g. https://www.google.com/search?q=regular+expression+decimal+number" rel="nofollow - regular expression decimal number  gives ^[-+]?\d+(\.\d+)?$
If I understand you correctly, what you want is a bit more complex: a decimal value >=0 and <=1, so things like 0, 0.1, 0.999, 1.0, 1, but not -0.1, 3.2, 5e-1 or 17. I'd break that into four alternative parts: 0 or 0.* or 1.0 or 1, so:
0|0\.[0-9]+|1\.0+|1


Posted By: Saivignesh
Date Posted: 03.May.2017 at 11:07
Thank you so much.!Smile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net