I need to get two values from this HTML, which is either an error or a success from toast-*
, and also get the value inside the toast-message
:
<div class="toast toast-error" style="">
<div class="toast-message">You have failed.</div>
</div>
<div class="toast toast-success" style="">
<div class="toast-message">You have succeed.
</div>
The div
elements only show once at a single time, which can be either error or success.
Is there any way I can use regex, so I can extract the value within array so it either:
['success', 'You have succeed.']
or
['error', 'You have failed.']
Any help would be greatly appreciated. Thanks!