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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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