No results for

Powered byAlgolia
⚠️ This is archived documentation for v0.31. Go to the latest version

findBetween(content, left, right)

suggest edits

Function that returns a string from between two other strings.

contentstringThe string to search through (e.g. Response.body)
leftstringThe string immediately before the value to be extracted
rightstringThe string immediately after the value to be extracted


stringThe extracted string, or an empty string if no match was found


import { findBetween } from '';
export default function () {
const response = '<div class="message">Login successful!</div>';
const message = findBetween(response, '<div class="message">', '</div>');
console.log(message); // Login successful!