title: Extra characters on the end of replaced text
body: <p>In PHP and Java, I applied <code>/^[^\pL]*|[^\pL]*$/</code> to ‍‍‍<code>-A-</code> and I got <code>*A**</code>. I applied a symmetric pattern and got an asymmetric result! Why?  I wonder why its output is not <code>*A*</code>?</p>
  
  <p>Pattern says that every thing except letter in the end of string should be replaced by <code>*</code>, it's also greedy and should replace all non-letter stuff together.</p>
  
  <p>Alos note in RegexBuddy I get <code>*A*</code> that is what I expect.</p>
  
  <p><strong>Update:</strong> I simplified the question to focus my main concern. </p>