You can use this:
function getYelpID(url) {
var m=/^(?:https?:\/\/)?(www\.)?yelp\.com\/biz\/([^\/]+)$/i.exec(str);
return m ? m[1] : null;
}
More Related Contents:
- jQuery selector regular expressions
- Backslashes – Regular Expression – Javascript
- How to capture an arbitrary number of groups in JavaScript Regexp?
- How to remove all line breaks from a string
- Regex pattern to match at least 1 number and 1 character in a string
- RegEx for Javascript to allow only alphanumeric
- Alternation operator inside square brackets does not work
- Regex using javascript to return just numbers
- regex.test V.S. string.match to know if a string matches a regular expression
- Convert camelCaseText to Title Case Text
- Regular expression not working for at least one European character
- Regular expression to match A, AB, ABC, but not AC. (“starts with”)
- How to parse a URL?
- List of all characters that should be escaped before put in to RegEx?
- Match any non-word character (excluding diacritics)
- How can I select an element by ID with jQuery using regex?
- Why does String.match( / \d*/ ) return an empty string?
- Regex to replace everything except numbers and a decimal point
- RegEx: How can I match all numbers greater than 49?
- In a regular expression, match one thing or another, or both
- (*SKIP)(*FAIL) workaround in JavaScript RegExp
- What are non-word boundary in regex (\B), compared to word-boundary?
- What is the need for caret (^) and dollar symbol ($) in regular expression?
- Replacing accented characters with plain ascii ones [duplicate]
- Best way to parse HTML in Javascript
- How to insert space every 4 characters for IBAN registering?
- Regular Expression Pattern With A Variable
- How can I use regex to get all the characters after a specific character, e.g. comma (“,”)
- Extract keyword from Google search in Javascript
- Regex matching emoticons