This question already has answers here:
regular expression: a line of string contains only float numbers and tab/spaces
(3 answers)
Parsing scientific notation sensibly?
(4 answers)
Closed 7 years ago.
Livecode's isNumber returns true when certain text strings are used. isNumber("one") returns true. I need a "strict" isNumber function where any strings would return false. Needs to handle +/-, integers, reals, e notation preferably. I'm looking for a PCRE regex for matchText(pValue, regexHere)
Related
This question already has answers here:
Reference - What does this regex mean?
(1 answer)
Learning Regular Expressions [closed]
(1 answer)
Closed 3 years ago.
I need a regular expression which accepts following format
1111A or 1234B.
I used /([0-9]{0,4})&([A-Z])/ but not able to get it.
Try using ^\d{4}[A-Z]$
const re = RegExp(/^\d{4}[A-Z]$/);
console.log(re.test('1111A'));
console.log(re.test('1A111'));
console.log(re.test('1111AA'));
This question already has answers here:
RegEx for both, integer and float [closed]
(3 answers)
Closed 4 years ago.
trying to write the appropriate regex expression to capture barometric pressure with two string possibilities. looking to simply grab the float values and remove the "in" string.
The String possibilities are (examples):
'30.01in'
or
'30in'
my current expression (see below) works for the former (30.01), but fails to grab the float in the latter (30in)
re.compile('[0-9]?[0-9]\...')
(\d+(?:\.\d+)?)in
This should capture ints or floats
This question already has answers here:
Regex to allow decimal numbers greater than 0 and less than 100
(3 answers)
Regular Expression to accept all the decimals from 0 to 100
(7 answers)
how to match a number which is less than or equal to 100?
(7 answers)
Closed 4 years ago.
I'm trying to write a regular expression to validate a form field that is allowed to have a decimal data type, up to 8 digits long, that is greater than 0 but less than 100. The following seems to be close, although it permits zero and that is where I'm stuck. What should be modified to prevent zero from matching?
^([0-9]{1,2})(\.[0-9]{0,8})?$
Use a positive look behind
^([1-9]?(?<=[1-9])[0-9]?)(\.[0-9]{0,8})?$
learn more here https://www.regular-expressions.info/lookaround.html
and use this to play around with
https://regex101.com/
This question already has answers here:
How to write regex to match number ranges?
(7 answers)
Closed 8 years ago.
I need a RegEx to match the following format:
3
7.3
5.7 (2.2-10.4)
I want to check in JS if the given value i.e. 5.7 (2.2-10.4) is valid. And in PHP I want to split the string to get all three values (if there is a given range).
That means I have to check for a simple numeric value (int and float) or a numeric value followed by a range like (d-d)
My attempt: /^(\d+)\s\((\d+)\-(\d+)\)$/
based on your attempt, does not count for negative values
^(\d+(?:\.\d+)?)(?:\s*\((\d+(?:\.\d+)?)-(\d+(?:\.\d+)?)\))?$
Demo
This question already has answers here:
Regular Expression: Numeric range [duplicate]
(9 answers)
Using regular expressions to validate a numeric range
(11 answers)
Closed 8 years ago.
Can somebody help me with this regular expression?
Numbers that are anything from 100 to 9999. Excluding 112, 144 and the whole 900 - 999 range.
This is a great opportunity to not use regular expressions at all. You are interested in the value of the numbers not their textual format so just convert the value into an integer ( if the conversion fails you have bad input ) and then perform a numerical analysis on it.
This will be easier, more readable and very probably perform better than using a regular expression.
You can use this regex if regular script/language constructs don't work for you:
^(?!(9[0-9]{2}|112|144)$)[1-9][0-9]{2,3}$