I have a string:
users/554983490\/Another+Test+/Question????\/+dhjkfsdf/
How would i write a RegExp that would match all of the forward slashes NOT preceded by a back slash?
EDIT: Is there a way to do it without using a negative lookbehinds?
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.
If your regular expressions support negative lookbehinds:
Otherwise, you will need to match the character before the
/as well:This matches either the start of a string (
^), or (|) anything other than a\([^\\]) as capture group #1(). Then it matches the literal/after. Whatever character was before the/will be stored in the capture group$1so you can put it back in if you are doing a replace….Example (JavaScript):