Monks, Today my colleague asked me to just replace the entities ~~~ with ~~~ in a small file. Both side of the entities, alphabets or digits or underscore ll be there. So i just wrote a small script but i found strange behaviour.
So i tried with small string sample and found the same answer as shown below:
First tested: ------------- $str = 'abac 123 afa123f'; $str =~ s|\B123\B|***|g; print $str; output i got as i expected: --------------------------- abac 123 afa***f Second tested: -------------- $str = 'abac ~~~ afa~~~ +;f'; $str =~ s|\B\&\#x0007E\;\&\#x0007E\;\&\#x0007E\;\B|~~~|g; print $str; output i got: ------------- abac ~~~ afa~~~f expected output: ---------------- abac ~~~ afa~~~f
For clarification i went through the documentation as well, it says what i expected. Why this strange behaviour. Where am i going wrong?
Prasad
In reply to Word boundary '\B' - Question by prasadbabu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |