How to search for JavaScript variables in a file, using Python?
If you use an IDE such as phpstorm, it can easily find variables for you. I don't see the use in programming something in Python to do this.
I have directory with many JaveScript files. Here I want to scan each file and want to replace each JavaScript variable with string like 'str1', 'str2', 'str3', ..., 'strn' and so on.
My question is: how to identify a JavaScript variable?
Doubts:

If I say keyword after var is a variable, however there is no compulsion of var while declaring variable
If I say keyword before = is a variable, however file also contains HTML code, so inside HTML tag there is = sign between attribute and its value.

So how can I identify the variables I have to replace?