Handle curly braces inside strings in StringUtils.matchToClosingParenthesis

This is required to extract fully more complex YouTube nsig functions.
This commit is contained in:
ThetaDev
2022-08-12 13:30:33 +02:00
committed by AudricV
parent d12003651b
commit 52ded6e3d7
2 changed files with 56 additions and 4 deletions

View File

@@ -58,4 +58,14 @@ public class StringUtilsTest {
assertEquals(expected, substring);
}
@Test
void find_closing_with_quotes() {
final String expected = "{return \",}\\\"/\"}";
final String string = "function(d){return \",}\\\"/\"}";
final String substring = matchToClosingParenthesis(string, "function(d)");
assertEquals(expected, substring);
}
}