Find consecutive "//" in regex in JavaScript

Posted by iOnline247 on Stack Overflow See other posts from Stack Overflow or by iOnline247
Published on 2011-11-29T01:35:37Z Indexed on 2011/11/29 1:49 UTC
Read the original article Hit count: 307

Filed under:
|

I gave it a college try, but I'm stumped. I'm trying to find consecutive slashes within a string. The rest of the regex works great, but the last part I can't quite get.

Here's what I have:

val.match( /^[\/]|[~"#%&*:<>?\\{|}]|[\/|.]$/ ) 

and finding this thread, I decided to update my code to no avail: RegEx to find two or more consecutive chars

val.match( /^[\/]|[\/]{2,}|[~"#%&*:<>?\\{|}]|[\/|.]$/ ) 

What do I need to get this thing going?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex