regex - How can I condense stand-alone characters in Perl? -


I am trying to identify and dissolve single (uppercase) letters in the string. For example:

"Test AB Exam" -> "Test AB Exam"

"Exam ABC Test" -> "Exam ABC Exam" / P>

"test AB test CDE test" -> "Exam AB Exam CDE Exam"

I have worked for single events (as in the example above), but It can not be ascertained how to chain series for many events.

$ str = ~ s / ([AZ]) ([AZ]) / \ 1 \ 2 / g;

When I see the solution, I may feel stupid, but I am ready for it. thank you in advanced.

  $ str = ~ s / \ b ([AZ]) \ s + / $ 1 / g (= [AZ] \ b?);  

Comments