Regular Expression issue
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 03:24 PM
Hi All,
How to write Regular Expression to find out words start with ADC followed by numbers in a string. The numbers can be of either 1 or 2 or 3 or n digits.
For Ex: ADC3456
Thanks!
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 03:37 PM - edited 09-20-2023 03:41 PM
Hi @pramodkumar ,
Try this expression.
/ADC[0-9]+/g
Example:
var text = "Test ADC123";
var n = text.search(/ADC[0-9]+/g); //n will have the value as 5
Thanks,
Anvesh
Anvesh