Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi!

(((13*(a7))+((12*(a6))+((11*(a5))+((10*(a4))+((8*(a2))+(9*(a3)))))))*(1*(a1)))

Can you suggest me a regex logic to make all (a'integer') to be a'integer'?
For the given line above my desired output is

(((13*a7)+((12*a6)+((11*a5)+((10*a4)+((8*a2)+(9*a3))))))*(1*a1))

What I have tried:

I tried to generate a pattern using some online regex simulators, but i have no experience in this and is difficult for me. Also please suggest me some simple notes to know more about regex.
Posted
Updated 16-Nov-21 6:20am

RegExr: Learn, Build, & Test RegEx[^] contains reference details. you can also Google for other sites with full tutorials.
 
Share this answer
 
Try this regex:
(?:\()(a\d+)(?:\))

And use this as the replacement string:
$1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900