I have come across come code written by another developer and I can not working out what it is doing:
title.replace(/(<([^>]+)>)/ig," ")
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.
It replaces all tags (substrings on the form
<...>) with a space," ".Here’s a regexp breakdown:
<– a left tag[^>]– anything but a right tag…+– …one or more times>– a right tag.The
(and)just surrounds the groups in the expression, which are not used anyway.The
/igsuffix says that the regex is case insensitive (pointless in this case, since the rexeg doesn’t mention any letters) and global stating that all occurrences should be replaced.