src.pydasa.validations.patterns#
Regex patterns for validation and parsing in PyDASA.
- Contains:
LaTeX validation patterns
FDU (Fundamental Dimensional Unit) matching patterns
Default and working pattern sets for dimensional analysis
Attributes#
LaTeX regex pattern to match LaTeX symbols (e.g., 'alpha') with optional subscripts (e.g., 'mu_{1}', 'lambda_{s}') in PyDASA. |
|
Regex pattern to match LaTeX-like variable tokens with optional subscripts, |
|
Default regex to match FDUs with exponents (e.g., 'M*L^-1*T^-2' to 'M^(1)*L^(-1)*T^(-2)'). |
|
Regex pattern to match dimensionless coefficients in PyDASA (e.g, 'Pi_{1}', 'Pi_{2}'). |
|
Regex pattern to match dimensionless coefficients with power operations in PyDASA (e.g., 'Pi_{1}**(-2)'). |
|
Regex pattern to match numeric constants (e.g., '3.14', '-2.5e3') in PyDASA. |
|
Regex pattern to split expressions by basic operations (, /, ^, +, -) in *PyDASA. |
|
Set of LaTeX expressions to ignore during parsing in PyDASA. |
Module Contents#
- src.pydasa.validations.patterns.LATEX_RE: str = '\\\\?[a-zA-Z]+(?:_\\{[a-zA-Z0-9_]+\\})?'#
LaTeX regex pattern to match LaTeX symbols (e.g., ‘alpha’) with optional subscripts (e.g., ‘mu_{1}’, ‘lambda_{s}’) in PyDASA.
- src.pydasa.validations.patterns.LATEX_VAR_TOKEN_RE: str = '(\\\\[A-Za-z]+|[A-Za-z][A-Za-z0-9]*)(?:_(?:[A-Za-z0-9]+|\\{(?:[^{}]|\\{(?:[^{}]|\\{(?:[^{}]|\\{(...#
Regex pattern to match LaTeX-like variable tokens with optional subscripts, supporting up to 5 levels of nested braces inside subscripts.
Examples
‘alpha’, ‘mu_{1}’, ‘M_{buf_{AS}}’, ‘M_{a*(c*t_{R_{P*(A*(C*S))}})}’
- src.pydasa.validations.patterns.DFLT_POW_RE: str = '\\-?\\d+'#
Default regex to match FDUs with exponents (e.g., ‘M*L^-1*T^-2’ to ‘M^(1)*L^(-1)*T^(-2)’).
- src.pydasa.validations.patterns.PI_COEF_RE: str = '\\\\Pi_\\{\\d+\\}'#
Regex pattern to match dimensionless coefficients in PyDASA (e.g, ‘Pi_{1}’, ‘Pi_{2}’).
- src.pydasa.validations.patterns.PI_POW_RE: str = '(\\\\Pi_\\{\\d+\\})\\s*\\*\\*\\s*\\(([^)]+)\\)'#
Regex pattern to match dimensionless coefficients with power operations in PyDASA (e.g., ‘Pi_{1}**(-2)’).
- src.pydasa.validations.patterns.NUM_CONST_RE: str = '^[-+]?\\d*\\.?\\d+(?:[eE][-+]?\\d+)?$'#
Regex pattern to match numeric constants (e.g., ‘3.14’, ‘-2.5e3’) in PyDASA.
- src.pydasa.validations.patterns.BASIC_OPS_RE = '(\\*|\\/|\\+|\\-|\\^)'#
Regex pattern to split expressions by basic operations (, /, ^, +, -) in *PyDASA.
- src.pydasa.validations.patterns.IGNORE_EXPR#
Set of LaTeX expressions to ignore during parsing in PyDASA.