I’m trying to find a regex to split a call to a method
boo(a,b), c
so it would return
boo(a,b)
and
c
after splitting by it.
Is it possible doing it with regex?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Regular languages cannot express recursion. At the point where you realise that the solution would involve recursion, it is not possible to express this in a “pure” regex engine (in practice, most regex engines have some sort of extension to allow limited violation of this rule).
Since you’re writing in a Java context – why not use the nice programming language to perform this fairly simple manipulation of a string, rather than trying to shoehorn a regex into the solution? 🙂