I
I
Ibishka2020-05-21 14:03:24
Regular Expressions
Ibishka, 2020-05-21 14:03:24

How to search in text using regexp?

For example, there is a text:
"$('#blabla').html('blabajsj')"
I need to find $('') and take what's inside it and find html() and take what's inside. How to do it with regular expressions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-05-21
@Ibishka

let s = "$('#blabla').html('blabajsj')";
let m = s.match(/\$\('([^']+)'\)\.html\('([^']+)'/);
console.log(m);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question