RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Floating Complex Number
Expression
^([-+]?(\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?[r]?|[-+]?((\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?)?[i]|[-+]?(\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?[r]?[-+]((\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?)?[i])$
Description
DESCRIPTION Parses a complex number of kind 'a+bi' from an input string. Please remove all spaces from the input string before using this regex pattern. MATCHING EXAMPLES '[]' means is an optional parameter; '|' means OR; '+' is the positive sign; '-' is the negative sign; '#' is one ore more decimal digits; 'E|e' are the valid exponent symbols; '...' is the range for the exponent; 'r' means the real part of complex number; 'i' means the imaginary part of complex number. NOTE Has the imaginary part of the input string not a numeric value (e.g. '5-i' is a valid format) it should be interpreted as '5-1i'!
Matches
[+|-]#[.[#]]|[#].#[E|e[+|-]0...299][r] -OR- [+|-][#[.[#]]|[#].#[E|e[+|-]0...299]]i -OR- [+|-]#[.[#]]|[#].#[E|e[+|-]0...299][r]+|-[#[.[#]]|[#].#[E|e[+|-]0...299]]i
Non-Matches
[+|-][.][E|e[+|-][0...299]][r] -OR- [+|-].[E|e[+|-][0...299]]i -OR- [+|-][.][E|e[+|-][0...299]][r]+|-[#[.[#]]|[#].#[E|e[+|-][0...299]]]i -OR- any number with more than one sign or decimal seperator -OR- any string with non-leading signs on mantissa and on exponent
Author Rating: The rating for this expression. Fischer, M.
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials