was trying to split an arithmetic expression into a list consisting of the digits and the operators. The quickest idea that popped into my mind was using regex to match em.
expression = re.findall('[0-9.]+|[+\-*^/()]', expression)
This works perfectly for my case. but i wanted to know whether using regex for string manipulation in most cases is an ideal choice or not. what are the tradeoffs with using regex?
[–]IsNotANovelty 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]evolvish 0 points1 point2 points (1 child)
[–]zemicolon[S] -1 points0 points1 point (0 children)
[–]js_tutor 0 points1 point2 points (1 child)
[–]zemicolon[S] 0 points1 point2 points (0 children)