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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Arithmetic expression assignment
Expression
(?<id>[A-Za-z_][0-9A-Za-z_]*) (?<op>\=) (?: (?> (?: (?<= ((\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | [A-Za-z_][0-9A-Za-z_]* | \) ) (?<op> \+ | \* ) ( ?= ((\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | [A-Za-z_][0-9A-Za-z_]* | \( ) ) | ( ?<parenthesis> ( ?<= \= | \+ | \* | \( ) (?<op>\() ( ?= ((\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | [A-Za-z_][0-9A-Za-z_]* | \( ) ) | ( ?<-parenthesis> ( ?<= ((\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | [A-Za-z_][0-9A-Za-z_]* | \) ) (?<op>\)) (?! ((\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | [A-Za-z_][0-9A-Za-z_]* ) ) | (?: (?<= \= | \( | \+ | \* ) (?: (?<const>(\.[0-9]+|[0-9]+(\.[0-9]+)?)([eE][-+][0-9]+)?|[0-9]+) | (?<id>[A-Za-z_][0-9A-Za-z_]*) ) ( ?=$ | \) | \+ | \* ) ) )+ ( ? ( parenthesis ) (?!) ) )$
Description
I use this expression to parse assignment of arithmetic expression. Supports alphanumeric id, scientific numbers, brackets, +/* operators and assignment.
Matches
COST=(PRICE+TAX)*0.98e+4+(1+2)*3|x=a*b+(c+d)*5|t=1
Non-Matches
x|1|COST=(PRICE+TAX)*0.98e+4+(1+2)*
Author Rating: Not yet rated. Bereznikov Alexey
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-2025, RegexAdvice.com | ASP.NET Tutorials