

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do you access the matched groups in a JavaScript regular expression?
To access the matched groups in a JavaScript regular expression, you can try to run the following code −
Example
<html> <head> <script> var str = "Username akdg_amit"; var myReg = /(?:^|\s)akdg_(.*?)(?:\s|$)/g; var res = myReg.exec(str); document.write(res[1]); </script> </head> <body> </body> </html>
- Related Questions & Answers
- How do we use Python Regular Expression named groups?
- How do you validate a URL with a regular expression in Python?
- Counting the number of groups Java regular expression
- How to get the number of capture groups in Python regular expression?
- How to define a Regular Expression in JavaScript?
- How do I clear the regular expression cache in Python?
- Named capture groups JavaScript Regular Expressions
- How do you access jagged arrays in C#?
- Regular Expression Matching in JavaScript
- How do you use regular expressions in Cucumber?
- Can you explain Python Regular Expression Syntax in a simple way?
- How to test and execute a regular expression in JavaScript?
- How do we use re.finditer() method in Python regular expression?
- Replacing all the matched contents Java regular expressions
- How do you get a timestamp in JavaScript?
Advertisements