简体   繁体   中英

What does the backslash syntax mean in Javascript?

I recently ran into javascript code that looks like this:

if(/a=er/i.test(querystring) || /a=nwr/i.test(querystring))

I am not familiar with the part /a=er/i or /a=nwr/i syntax. I know that backslashes in javascript are escape characters, but they should be inside strings.

I have been googling and couldn't find an answer. The code executes with not issue, I am just unfamiliar with this syntax.

Those are just some Regular Expressions!

Learn more about them from Mozilla's JavaScript Guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM