for example I have<img className='class' src='somelink' />
and I want to grab just className='class'
I already tried / className='.+'[ |>]
Im traversing files looking for all classNames but this img example gives me everything including the src='...'
what would be a good expression to give me all classNames and only the classNames with any possibilities inside the quotes?
Asked
Active
Viewed 213 times
1

Gavyn
- 99
- 7
-
I'm obviously super new with regex and don't understand it that well – Gavyn Jul 12 '17 at 01:29
1 Answers
1
You should use className='.+?'
. This will make the expression "lazy" instead of "greedy". Basically, greedy means that the expression will find everything up to the last '
in the whole string while lazy means it will stop as soon as it finds the first '
.

DonovanM
- 1,174
- 1
- 12
- 17