
This will check if a number is an integer. Integers or decimal numbers with or without the exponential form. A regular expression that matches numbers. Negative Lookahead: In this type of lookahead the regex engine searches for a particular element which may be a character or characters or a group after the item matched. In "excel formula vervion", it's a no biggy, substitute spaces with nothing and check if -3rd character from search ("end") is a decimal. This regular expression validates that the data entered is a number with a maximum of two integers and two decimals and a minimum of one integer or one decimal. This regex will match all USD words followed by a number of one or more digits.
Regex for number that might have decimal verification#
I was just thinking of placing a verification check to make sure that we are not picking up the "end" from a fare basis code like a kend14nr. Then here is where there may be an issue.the fare basis code - LXA7NJ4įara basis codes can range from 1 letter like F to about 12 or so charaters.F, Y06, LXA7NJ4, K8484/CKE.Usually the first letter is the booking class, the rest of the charaters vary. The next part is base amount of the fare - 263.26 SLC// is the destination - SALT LAKE CITY Here's how the price you pay for an airline ticket is broken down.in the fare calculation line.they can be long or short. Execute(s) For i = 0 To oMatches.Count - 1 temp = temp & oMatches(i) & "," Next i GetNumbers = Left(temp, Len(temp) - 1) End IfEnd WithEnd Functionīoth solutions work just perfectly, thank you. If I use a field of type 'text' the regex correctly understand the decimal 0 or 5, so the regex expression is correct.

It correctly evaluate to true if the decimal is a 5. The problem is that the regex evaluate to false when i place a 0 at the decimal.


I am trying to adapt the code to my situation.įunction GetNumbers(s As String)Dim temp As String, i As Long, oMatchesWith CreateObject("vbscript.regexp"). What this says is that i want a number to looks like this: 10.5 or 6.0 etc. Now how do I pull only the amounts before the word end.
