|
8 | 8 | #let patterns = ( |
9 | 9 | element: regex( |
10 | 10 | "^([A-Z][a-z]?)" + |
11 | | - "(?:(_?\\d+)|(\\^\\.?[+-]?\\d+[+-]?|\\^\\.?[+-.]{1}|\\^?[+-]?[IV]+|\\.?[+-]{1}\\d?))?" + |
12 | | - "(?:(_?\\d+)|(\\^\\.?[+-]?\\d+[+-]?|\\^\\.?[+-.]{1}|\\^?[+-]?[IV]+|\\.?[+-]{1}\\d?))?" + |
13 | | - "(\\^\\^[+-]?(?:[IViv]{1,3}|\\d+))?" |
| 11 | + "(?:(_?\d+)|(\^\.?[+-]?\d+[+-]?|\^\.?[+-.]{1}|\^?[+-]?[IV]+|\.?[+-]{1}\d?))?" + |
| 12 | + "(?:(_?\d+)|(\^\.?[+-]?\d+[+-]?|\^\.?[+-.]{1}|\^?[+-]?[IV]+|\.?[+-]{1}\d?))?" + |
| 13 | + "(\^\^[+-]?(?:[IViv]{1,3}|\d+))?" |
14 | 14 | ), |
15 | 15 | group: regex( |
16 | | - "^((?:\\([^()]*(?:\\([^()]*\\)[^()]*)*\\))|(?:\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\})|(?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]))" + |
17 | | - "(?:(_?\\d+)|(\\^\\.?[+-]?\\d+[+-]?|\\^\\.?[+-.]{1}|[+-]{1}\\d?))?" + |
18 | | - "(?:(_?\\d+)|(\\^\\.?[+-]?\\d+[+-]?|\\^\\.?[+-.]{1}|[+-]{1}\\d?))?" |
| 16 | + "^((?:\([^()]*(?:\([^()]*\)[^()]*)*\))|(?:\{[^{}]*(?:\{[^{}]*\}[^{}]*)*\})|(?:\[[^\[\]]*(?:\[[^\[\]]*\][^\[\]]*)*\]))" + |
| 17 | + "(?:(_?\d+)|(\^\.?[+-]?\d+[+-]?|\^\.?[+-.]{1}|[+-]{1}\d?))?" + |
| 18 | + "(?:(_?\d+)|(\^\.?[+-]?\d+[+-]?|\^\.?[+-.]{1}|[+-]{1}\d?))?" |
19 | 19 | ), |
20 | | - reaction-plus: regex("^\\s*\\+\\s*"), |
| 20 | + reaction-plus: regex("^\s*\+\s*"), |
21 | 21 | reaction-arrow: regex( |
22 | | - "^\\s*(<->|↔|<=>|⇔|->|→|<-|←|=>|⇒|<=|⇐|-/?\\>|</-)" + |
23 | | - "(?:\\[([^\\[\\]]*)\\])?" + |
24 | | - "(?:\\[([^\\[\\]]*)\\])?" + |
25 | | - "\\s*" |
| 22 | + "^\s*(<->|↔|<=>|⇔|->|→|<-|←|=>|⇒|<=|⇐|-/?\>|</-)" + |
| 23 | + "(?:\[([^\[\]]*)\])?" + |
| 24 | + "(?:\[([^\[\]]*)\])?" + |
| 25 | + "\s*" |
26 | 26 | ), |
27 | | - math: regex("^\\$[^$]*?\\$"), |
28 | | - state: regex("^\\((s|l|g|aq|solid|liquid|gas|aqueous|aqua)\\)"), |
| 27 | + math: regex("^\$[^$]*?\$"), |
| 28 | + state: regex("^\((s|l|g|aq|solid|liquid|gas|aqueous|aqua)\)"), |
29 | 29 | ) |
30 | 30 |
|
31 | 31 | #let get-count-and-charge(count1, count2, charge1, charge2) = { |
|
0 commit comments