MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Value Regex
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Value Regex

 Post Reply Post Reply
Author
Message
Saivignesh View Drop Down
Contributor
Contributor


Joined: 01.May.2017
Location: Netherlands
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Saivignesh Quote  Post ReplyReply Direct Link To This Post Topic: Value Regex
    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?
 
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Answer Answer
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 01.May.2017 at 17:23
There are two approaches to making regular expressions:
  1. Learn regular expression syntax, e.g. from the MetaEdit+ Workbench user guide Appendix A: Regular expressions
  2. Search the forums or Google for each one you want, e.g. 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
Back to Top
Saivignesh View Drop Down
Contributor
Contributor


Joined: 01.May.2017
Location: Netherlands
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Saivignesh Quote  Post ReplyReply Direct Link To This Post Posted: 03.May.2017 at 11:07
Thank you so much.!Smile
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.033 seconds.