I have the following lines,
data:text/javascript;base64,Ly8gSGVyZdsdsd:5
data:text/javascript;base64,Ly8gSGVyZdsdsd:2
data:text/javascript;base64,Ly8gSGVyZdsdsd:1
I want to select the second line of text above using a regex that matches string that ends in 2? I'm stuck, this is what I have:
^.*$
You can use a very simple pattern
string.match(/.*2$/m)
=> ["data:text/javascript;base64,Ly8gSGVyZdsdsd:2"]
Where m stands for multiline. Without that the $ will be matched at the end of the string, whereas with this it will match end of each line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With