Don’t write a regex! This is trivial to do with string functions instead:
var final = id.substr(id.lastIndexOf("https://stackoverflow.com/") + 1);
It’s even easier if you know that the final part will always be 16 characters:
var final = id.substr(-16);
More Related Contents:
- Regex for Email Address along with name format [duplicate]
- Negative lookbehind equivalent in JavaScript
- Remove not alphanumeric characters from string
- Regular Expression | Leap Years and More
- How to write regex to validate dates?
- Javascript – Regex to validate date format [duplicate]
- JavaScript Regex Global Match Groups
- RegEx: How can I match all numbers greater than 49?
- How do I split a string by whitespace and ignoring leading and trailing whitespace into an array of words using a regular expression?
- In a regular expression, match one thing or another, or both
- Regex only capturing last instance of capture group in match
- (*SKIP)(*FAIL) workaround in JavaScript RegExp
- What is the need for caret (^) and dollar symbol ($) in regular expression?
- Replacing accented characters with plain ascii ones [duplicate]
- Javascript RegExp for splitting text into sentences and keeping the delimiter
- How to insert space every 4 characters for IBAN registering?
- How can I use regex to get all the characters after a specific character, e.g. comma (“,”)
- javascript regex : only english letters allowed
- Regex JavaScript image file extension [closed]
- Removing backslashes from strings in javascript
- Javascript function need allow numbers, dot and comma
- Why this regex is not working for german words?
- Remove everything within script and style tags
- URL regex validation
- I would like to mimick conditionals in javascript regex
- In JavaScript, how can I replace text in an HTML page without affecting the tags?
- Get text between two rounded brackets
- Preg_match to regex equivalent expression to match any Unicode letters
- JavaScript: RegExp constructor vs RegEx literal
- Find and replace nth occurrence of [bracketed] expression in string