How can I split a string into pieces every time a "/*-+" appears and keep the delimiter? So, have something like
10x+4-1
turn into
10x
+
4
-
1
I've tried
@left_split = split(/(?<=\+)(?<=\-)(?<=\/)(?<=\*)/, $left_side);
I want the delimiter to be placed in its own array [].
However, if something like
4(x-3)
appears, how do I stop the reg-ex from splitting the 4(x and - 3)?
Aucun commentaire:
Enregistrer un commentaire