A
A
Asikov Artur2020-02-14 12:07:11
Regular Expressions
Asikov Artur, 2020-02-14 12:07:11

What regular expression can be used to find the text between +?

There is a reaction

KMnO4 + HCl = KCl + MnCl2 + Cl2 + H2O

how, using a regular expression, you can get substances from it that stand after the equal sign? (the "+" sign must be removed)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-02-14
@Artur937

Why is there a regular? Split string on =, split second part on +.
The specific implementation depends on the programming language. For example in PHP:

$str = 'KMnO4 + HCl = KCl + MnCl2 + Cl2 + H2O';
$list = explode('+', explode('=', str_replace(' ', '', $str))[1]);
print_r($list);
Array
(
    [0] => KCl
    [1] => MnCl2
    [2] => Cl2
    [3] => H2O
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question